So, I have an idea of creating highload app using Ruby on rails. However there are some questions about the conception of the project.

The main idea is

Client->Load Balancer -> Server_1 ->Database_1 (Master)
                      -> Server_2 ->Database_2 (Slave)

I've understand that the load balancer analyzes the traffic and send it to one of the servers. They call the database to retrieve data, but I want to include here

  1. Statistic server that gazer the data on many layer.
  2. API server that allows developers communicate with server.
  3. Cache server

Concerning the first item, I think that I should put it behind load-balancer too and just send important data to it via the application. Am I right? But I don't know where I should put the API server, because it should operate separately. Is there in load-balancer some functionality that allow resend request to another server, like if the query api.example.com/get/data/id/1 was asked, than send it to server_3 where methods that execute this query are?

And the last one question is about the cache server. I'm not quite understand how for example azure web-balancer works? Can it solve this issue or I should add my own cache server? And where should it be placed?

P.S. I'm just read it and try to build approximate picture of my project.

  1. Correct, your statistics gathering server should live entirely behind the load balancer. Have it consume the data directly from the servers, whether it tail's access logs, or you push data specifically to it, or whatever. It has nothing to do with the load balancer.

  2. Can the API co-exist with the main application? If it can, just install the API on both server_1 and server_2, on a different binding, and just let it load balance with everything else.

    If the API cannot co-exist on server_1 or server_2, then put it on the same level as the other servers (say, server-3) and put a rule in your load balancer to send requests that match api.example.com to server_3 only.

  3. I'm not sure what you mean by cache server. A cache server could be something like memcached or redis, in which case it lives behind your application server. But it could be something like varnish in which case it lives in front of your load balancer. Or, it could be something like Cloudflare or Fast.ly which lives outside your network, in between the client and your load balancer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.