I'm building a basic stock watcher application - let's call the currently-watched stock N. When the stock moves by X%, trigger a notification / event. X is defined on a per user basis.
The server holds the stock's current price, alongside the users last-known price (the last alert each user received)
What is the best way to architect this? I don't want to loop through each user upon any price movement to check if their set moved-percentage was reached, as that is quite obviously a huge performance issue.
Resources and links for further researching would be greatly appreciated.
I am building this in Javascript ( nodeJS to be precise), but I'm more interested in the concepts behind building this rather than direct code samples.
Thanks!