You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A not so uncommon optimization technique used by apps, it to use a background thread to regularly poll some data and keep a copy always accessible in memory.
Or similarly, it's not uncommon to have a background thread collect and emit metrics at common interval.
With Pitchfork this isn't ideal because you have to be very careful that all background threads are either shutdown or at a safe point when a worker is promoted or when the mold forks a new child.
Idea
Maybe not for 100% of use case, but I believe that in many cases such threads don't actually need to be in the mold nor workers, and could instead be in a separate process.
They also very often don't need an actual dedicated thread, they simply sleep in a loop to perform some action at regular interval.
As such, if we provided a task scheduling API similar to rufus-scheduler (e.g. every 10s), we could run these tasks on a single thread (or a low number of threads) in a dedicated worker, that's never used for promotion, hence for which forking at random points isn't a concern.
For the tasks that need to expose data to workers, they can use a variety of IPC solutions, such as a local key value store, shared memory (with Raindrops), write into file, sqlite3 database etc etc.
The text was updated successfully, but these errors were encountered:
A not so uncommon optimization technique used by apps, it to use a background thread to regularly poll some data and keep a copy always accessible in memory.
Or similarly, it's not uncommon to have a background thread collect and emit metrics at common interval.
With Pitchfork this isn't ideal because you have to be very careful that all background threads are either shutdown or at a safe point when a worker is promoted or when the mold forks a new child.
Idea
Maybe not for 100% of use case, but I believe that in many cases such threads don't actually need to be in the mold nor workers, and could instead be in a separate process.
They also very often don't need an actual dedicated thread, they simply sleep in a loop to perform some action at regular interval.
As such, if we provided a task scheduling API similar to
rufus-scheduler
(e.g. every10s
), we could run these tasks on a single thread (or a low number of threads) in a dedicated worker, that's never used for promotion, hence for which forking at random points isn't a concern.For the tasks that need to expose data to workers, they can use a variety of IPC solutions, such as a local key value store, shared memory (with Raindrops), write into file, sqlite3 database etc etc.
The text was updated successfully, but these errors were encountered: