For background, I have a cache that could contain a maximum of about 1000 objects. Each object, for all intents and purposes, is a flat structure with about 10 properties, so it's very SQL friendly, and I need to search this object cache in a variety of SQL query-like ways.I'd estimate this cache would get queried about 100 times per second for the first 10-15 seconds, and then about once per second after that. (It's those first 10-15 seconds that concern me because they happen while another piece of software is loading and eating up most of the system resources).The Node server this runs in is meant to be light weight, and is distributed and run locally on Windows machines -- as a matter of fact, it's intended to be PKG'd into a standalone executable -- so Redis isn't installed or available.A few options came to mind:A SQLite in-memory database, and write a JavaScript convenience wrapper to interact with it.A alternative JavaScript-based package. (If so, I'd welcome any recommendations).I'm way over-thinking this. The size and load is paltry. Just iterate through a Map and be done with it.What has me leaning towards (1) is that we're already using SQLite, so it's there. Plus I plan to use it for more things in the future anyway, so it would be nice to have a consistent interface for everything. And I'd like to do stuff like, for example, optionally dump it to a database file while testing/debugging.But I haven't been able to find any information on performance of in-memory SQLite databases vs. just plain JavaScript objects. And even if it's negligible in this case, I'd still be curious to know in general.Thank you in advance!
Submitted December 06, 2019 at 06:30PM by beaniemonk
No comments:
Post a Comment