0

I'm developing web application (javascript + php) and I have architectual issue. I have to send 4 requests to server. First will gather basic information (effectivity is OK), then after receiving data from server, I have to do 3 one-by-one requests to different services on the same server (results of first response are query parameters for second request and so on..) My question is, what will be better?

  1. I send 1 request to another server and then this server is communicating with target server (both are in LAN network) and after all process finished first server response to client with effect
  2. Send all requests directly from client to target server

below is quick-schema of the situation. enter image description here

Krystian
  • 105
  • 4
  • Your question is off topic for Serverfault because it appears to relate programming. It may be on topic for [StackOverflow](http://stackoverflow.com) but please [search](http://stackoverflow.com/search) their site for similar questions that may already have the answer you're looking for. – Dennis Kaarsemaker Mar 29 '13 at 11:32
  • I was thinking about the same thing, but I thought, that this group would be OK – Krystian Mar 29 '13 at 11:45
  • Serverfault would be ok for questions about managing the servers you need, Stack Overflow really is better suited for questions about developing applications. – Dennis Kaarsemaker Mar 29 '13 at 11:46
  • but it is question about architecture of system, not about strict howto implementation/programming problem. – Krystian Mar 29 '13 at 11:56

1 Answers1

0

The talk-direct-to-the-server approach will have the lowest latency.

The proxy approach will have the most load resilience.

Depending on what your priorities are, either approach will be best for you. If you're going to be dealing with a lot of traffic, the proxy approach will be the best mix of latency and overall performance. If you're going to be dealing with small amounts of traffic, but it's very important, the direct approach is likely better for you.

sysadmin1138
  • 133,124
  • 18
  • 176
  • 300
  • so we can say, that proxy approach is more scaleable? (Loadbalancing ect..) I'm doing major web app so I think that traffic will be quite large. But what about performance? whether will the connection time be noticeable between connecting two LAN servers and direct client-server connection? – Krystian Mar 29 '13 at 11:52
  • It will definitely add latency, though how much is hard to say. Could be as little as 1-3 miliseconds, or as much as 100; depends on how the connections work. Connection-pooling will help a lot (fewer connections to *create*, which reduced latency) so use that wherever you can. – sysadmin1138 Mar 29 '13 at 11:58
  • An alternate approach is to go the direct route, but put a load-balancer between the Internet and a pool of everything-on-the-same-box servers. The tricky part there will be session affinity and ensuring state is synced between the members of the server pool. – sysadmin1138 Mar 29 '13 at 11:59
  • hmm.. I think it is too complicated for me right now, but I will have this in my mind! thanks mate!! – Krystian Mar 29 '13 at 12:41