0

I haven't worked with servers in a while, so this is probably a really obvious question.

I'm using WeBRick on Heroku to host a Rails application (I know I should use a better server, but it's still very early). When the user clicks a button on my application, it starts about 100 Ajax calls at once to the server, each of which is going to call a method on the server side that accesses a URL, gets some data from it, and returns that. All the responses are put together into something cohesive once the client determines that all the Ajax calls have finished (using a counter).

It's slow in the first place, and I wasn't expecting my free Heroku app to be able to handle a lot of people using it at once gracefully. I was expecting it to run really slowly once a lot of people started using it.

I opened up two tabs in my Chrome and had them both make requests at the same time to Heroku. What happened there was that one person got to use it normally, but the other had to wait until the first person's requests had completely finished before starting.

Then I opened up one tab in Chrome and the other in Safari, except this time I used localhost instead of Heroku. Chrome went first and ran normally, and then I clicked the button in Safari. Safari didn't do anything for a while, and then eventually it started and they both seemed to be going more slowly.

What happened in the first case, and what are my options for improving this situation? I would also appreciate someone pointing to a resource or filling me in on the basics of what I don't know in this case.

4

0 に答える 0