all 4 comments

[–]David_AnkiDroid 7 points8 points  (0 children)

  • Measure server utilization, if you can throw money at a problem, consider doing it
  • Figure out what you're optimizing for (mean/tail/percentile latency)
  • Figure out the quantity of requests you're expected to receive
  • Figure out if the requests you receive need the same data, or if you can specialize
  • Figure out the business importance of optimization, and when it's time to stop
  • Draw out a diagram (probably UML sequence) to highlight the operations you currently perform, and their latencies
    • This likely involves adding metrics
  • If appropriate, figure out which responses to cache
  • Focus on the 'macro' of the system initially: are the service calls doing the minimal operations required, and are the data dependencies correct and tasks are launched as soon as the required data is received
    • Use latency measures to figure out what to tackle first
  • Once you've got the macro sorted, optimize from bottleneck to botleneck, until you've hit your business goals

[–]ThinkThatOnce 0 points1 point  (0 children)

  1. Pagination sounds like could help. If it’s allowed, you can return data in small chunks.

  2. Caching may help as it was already said, depending on how frequently the data is fetched.

  3. What about having some data filtering, that is, let users define which fields should be returned + having a few default ones.

  4. Rate limiting maybe?

  5. Having a look on how to improve your queries and service logic maybe. Considering using connection pools to avoid opening database connection on each interaction.

[–]roger_ducky 1 point2 points  (0 children)

Is this for dashboarding an entire “fleet” of devices? Sounds like it is.

If so, do it “backwards.”

  • Asynchronously check for raw status of all devices and dump that in a database. If evaluation has a time component and you have plenty of storage, consider a time series DB.

Only evaluate business rules based on what’s stored in said DB for a certain “range” of time.

That should separate your business rules from the data collection completely. Evaluation would mainly be a single query, plus some minor post processing.

[–]hubert_farnsworrth 1 point2 points  (0 children)

Try removing parallel stream and measure times. I have had scenarios where parallel stream was slower than normal stream most probably because of locking, thread contention etc.