How can I send an http request at a specific time?

What is the problem with having a HTTP GET/POST request that takes a long time to calculate?

  • If a job takes a long time to finish, why should I do that as an asynchornous task (e.g. via python celery) or similar if it works just fine to do this via a standard GET request? The calculation takes around 30 sec.

  • Answer:

    In isolation? Nothing. Take as long as you need. However, in production, you're going to be able to handle only so many concurrent requests. Say you have 20 application servers and they're all cranking away at this 30-second request. Visitor 21 comes to the site and has to wait 30 seconds for...well, anything.

Phil Darnowsky at Quora Visit the source

Was this solution helpful to you?

Other answers

If the network connections are unreliable, then a longer connection time means more chances for the connection to drop.

Miguel Paraz

If you're on AWS, their ELB's have a hard timeout of 60 seconds. So as pointed out, if you start getting a lot of concurrent requests, you could easily start hitting their timeout limit.

Jeff Carpenter

Forget about the technical aspects. Think about it from a user's perspective. Who would wait for 30s for a page to load? If you are a startup, chances are somebody is already doing it better. Can you afford to keep your users waiting for 30s? Ideally you should only process those things in a request that are absolutely necessary. Try to aim for <1s request/response time. Now, if your calculation takes 30s and parts of it can be processed in the background then you should use celery. For example: If there is a pdf processing app and it takes about 20s to process the pdf, then there is no point keeping the user waiting for 20s. Acknowledge that you have received the pdf, process the pdf in the background and notify the user via notifcations or email.That way the user knows what's happening in those 20s. if the calculation must take 30s then you are doing something wrong and you should rethink how you are doing it.

Dhiraj Thakur

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.