I’ve build a cpp program that performs the following workflow sequentially:
Read serialized data (0.3 ms)
Receive search metadata (0.00.. ms)
Search data (0.01 ms)
Return search data(0.00.. ms)
Right now, I run the program with nodejs shell exec and serve it with an express api. The api is not used by many users, so reading the data will be performed just once a while. But one user will do like 20 queries on the same data. So right now, reading is performed 20 times on the same data.
Obviously reading the data takes most of the time. Additionally, the data that is being read never changes. To speed up the workflow, I want to read the data once, then wait for requests. Just like a MySQL db, that is waiting for statements.
What would be your approach to do that?
- Should I build a socket server? (Feels overkill)
- Should I try to run the Programm in background, store the pid and use a nodejs shell exec solution? (Feels hacky)
I think I’m missing the right terms. And it would be awesome if you can push me in the right direction!