一次通过ajax请求很多

I send 10 ajax to get data at once, it spends about 7s ~ 10s to response all data, but if I run each ajax one by one, each ajax spends about 200ms ~ 900ms, it still take 7s ~ 10s to response all data.

My request is sending ajax to web server, and run store procedure at sql-server to get data, and response to client. All 10 ajax is the same, just sending different parameters to get different data.

So, my questions are

  1. Run time in each ajax is not very slow, but why it run at once becomes very slow?

  2. Is there any way to improve the performance?

You need to give more information about the whole flow, but these are the two things in my mind that you may want to check:

  • Is your server having problem reaching sql server? i.e. network itself is slow.

  • is your server reusing DB connection (connection pooling?) but not establishing connection each time when handling individual request.