What could be a good scalable alternative to polling data and then looping over a list of objects for triggering some action on those?

by user59271   Last Updated October 14, 2019 06:05 AM - source

So I have some naive implementation for the following problem:

  1. We have a list of objects with action methods that have to be trigger at some value of interest.
  2. This value is polled (or is streamed) from a remote server and is constantly changing.
  3. Let's say we have tens of thousands of such objects in the list, and the remote value changes every couple of tens of milliseconds.

What could be a good scalable alternative to such code in order to handle the requirements?

Pseudo-code code looks as follows:

while true:{
   //get some data from continosly changing source
   responseData = getRequest('http://some-remote-endpoint')
   //check our all objects of interest
   for object in list {
       /* if the object has to be triggered at a 
       specific remote source value, trigger an action on it. */
       if object.triggerAtValue == reponseData.value {

Related Questions

Alternative to SQS FIFO

Updated April 01, 2019 11:05 AM

Publish / Subscribe Paradigm Implementation Problems

Updated December 05, 2018 17:05 PM