php - Server side requests getting lost -


i've got problem haven't been able solve involving server-side requests timing out if try perform 5 or more requests simultaneously.

here's quick overview of architecture:

  • i have 1 server (server-a) hosts 2 websites (web-foo , web-bar).
  • web-foo exposes json api.
  • web-bar consumes web-foo's api, , exposes json api consumed client side.

here's simplified workflow:

  • a user visits web-bar, loading page.
  • when page needs data, ajax request made web-bar in turn creates server-side request web-foo data.

the above all works - until 5 (or more) ajax requests made simultaneously. @ point, things start timeout.

from server logs, can tell requests arrive @ web-bar, , web-bar fires off 5 server-side requests doesn't receive reply until 5 minutes pass (the timeout). @ point, web-foo's logs fill indicating everything's been processed correctly, web-bar's logs fill 504 gateway timeout errors.

here things i've tried:

  • make 4 ajax requests or less web-bar (this works)
  • configure web-bar respond directly ajax requests, , not perform server-side request web-foo (this works)
  • configure ajax requests directly call web-foo, bypassing web-bar (this works amount of requests, not can used solution)
  • strip down processing on web-bar identify bottleneck elsewhere - in accessing database (this doesn't fix problem)
  • configure web-foo make 5+ requests web-bar in php (this works, requests happen synchronously)
  • move web-bar server (this works! can initiate many simultaneous requests like, , i'll correct response)

i believe problem caused due 2 websites on same server trying perform server-side communication each other, , problem sort of networking issue. issue occurs when multiple (5+) requests initiated simultaneously. i'm stumped how proceed in debugging problem.

both websites built using laravel, , web-bar consumes web-foo's api using guzzle 6. "server-a" refers development environment homestead, though i've performed same tests on (forge provisioned) staging environment.

i'd appreciate suggestions continue debugging, or tools can use find out what's happening server-side requests, , where/if/how they're getting lost.

thanks!


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -