Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Alternatives to Long Web Requests with Long Timeouts

DZone's Guide to

Alternatives to Long Web Requests with Long Timeouts

· Performance Zone
Free Resource

Transform incident management with machine learning and analytics to help you maintain optimal performance and availability while keeping pace with the growing demands of digital business with this eBook, brought to you in partnership with BMC.

Earlier I posted about how you can't create a web request with a timeout of more than the internal maximum of 60 seconds.

I was asked on Twitter about how to have the server tell the app that there was new data for the app to display.

As I said in the original post, the exact method to use will depend on the application but here are the main techniques to consider.

Direct notification
If the app is still running and the server has some new data for the app to display, the server can tell the app directly. Either by telling the app to get it, or sending it directly.

  • Via a push notification (raw or toast)
  • Via a socket connection - like with SignalR ;)
Smart polling
Having the app just check if there is new data on a predetermined periodic basis isn't the best we can do.
  • If we've told the server we want some data and the server is indicating that it will be some time before the data is ready, the server should be able to provide an indication of how long it will be before the data is ready (based on typical load time, current queue size, etc.) The app can check back after that time. And, of course be given a new time if it isn't ready by then.
Offline notification
Of course, if the server is taking its time to generate (or prepare) the data the app needs, then it's possible that the app might not still be running when the data is ready. In this instance, the server may want to tell the user that there is data to view when they re-launch the app.
  • The obvious option here is with push notifications (toast and tile)
But less platform-specific options may also be valid too. Especially if combined with a custom schema to launch directly into the app.
  • SMS
  • Email
Of course, a better alternative to any of the above would be to have the data ready when the the user/app wants it. This could be done either by preparing the data in advance so it's ready when needed, or by being able to prepare it very quickly.

Evolve your approach to Application Performance Monitoring by adopting five best practices that are outlined and explored in this e-book, brought to you in partnership with BMC.

Topics:

Published at DZone with permission of Matt Lacey, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}