Closed kleeb closed 7 years ago
solved it by adding
--max-old-space-size=4096 --stack-size=1968
to the first line of app.js, additionally started using semaphores: http://stackoverflow.com/questions/37456690/how-insure-indexing-every-object-with-firebase-flashlight-in-a-elasticsearch-bon
Thanks for adding the solution! Is this in reference to indexing a large path in Firebase or retrieving a large number of results from ES on the client?
indexing large number of results (PathMonitor) when flashlight starts
Thanks for the update. Note that I added some advice on improving restart efficiency here.
Those advices are nice, but with refBuilder you are deciding which records to skip. How about if you don't want to skip any records at all, for instance if they are all part of a bigger shop.
The goal is simply not to load everything into memory at once. It's safe to assume, if your server runs all the time, that you've processed everything older than a day (a week; whatever makes sense) and use a timestamp. Then only load records newer than minusOneDay
or similar.
Some assembly required here, since I don't know your use case and goals, but you should be able to come up with a sensible query that doesn't load all the data.
Lets say I setup refBuilder to cache records added in the last 24 hours. How about the older once? Is there a way to setup some kind of scheduler or rule? Or will they be indexed anyway?
Am I right that refBuilder is used only at the startup?
My case is that I have around 1 million online catalogue items. More or less all need to be added and indexed. The project startup is not a problem, as I can add them periodically, but the whole solution will crash when the server needs a restart for any reason.
Isn't there a bug in the refBuilder docs? If we want to never look back more than a day during a server restart, shouldn't the condition be return ref.orderByChild('timestamp').startAt(Date.now() - 86400000); ?
I don't know your DB schema or what you've set up in security rules (indexOn needs to be configured right) but that should work.
Keep in mind that if you are storing 1 million catalog items in a single node, clients are going to have the same issues. You can't load those into memory anywhere effectively, you'll always need to use a query.
If you already have a million in the path, you won't be able to index them all at once using Flashlight. You'll either need to run it a few different times with different queries, or just manually iterate/paginate and index the records by accessing ES directly. Some assembly required.
Clear enough. Thanks you all info!
When the amount of data is big (like lets say 100K records, that are being cached at start) flashlight crashes: