How the PA "workers"

Hey there,

I am currently on the beginner plan and I am having an issue that I can't solve - when a user logs in to my site for the first time it needs to fire off a bunch of requests to Github to gather some data and this can take up to 30 seconds, and that is 30 seconds that the user can't do anything.

I have been looking for ways to solve this, and have so far come up short. But I see that if I upgraded to the hacker plan it would give me an additional web worker. Would it then be possible to use this to offload work on to that and have it interact with my original app?

Cheers, S

Yes, that would work -- but if another user came to your site, and you fired off another set of GitHub requests, that would block the second worker. Essentially, you need as many workers as you're likely to have requests running concurrently. Does that make sense?

As a site grows, what is the best way to determine how many web workers will be sufficient?

Good question! There are two factors:

  • How many requests per second your website receives at peak times.
  • How long you take to process each request.

If your site takes a really short time (let's say, 2ms) to respond to the average request, then one worker can handle 500 requests/second. If the site is slower, let's say 1.5 seconds/request, then one worker can handle 0.66 requests/second.

So what you need to do is work out how many requests/second you're getting at peak times (you can work this out from the web app's access log) and how long you take to respond to the average request when things are quiet (which is harder; probably best to use the developer tools in your browser). If 1/(request time) is higher than the peak requests/second, you're OK. If it's lower, then you need to add more workers.

Hi, I am also struggling with this.

I have different requests and they take different time to be answered. I would like to know when I am hitting the limit, instead of guessing using average times and requests.

Would I get a warning when some client has to wait for a worker? Is there a way to know how many people are in queue waiting for a "Free" worker?


Unfortunately there isn't an easy way for you to do that for yourself right now -- but we can dig up the information for you from our backend systems if you give us a time period you'd like us to look at.