Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I know it is possible to use Nginx to spread requests over multiple web servers thus doing load balancing. This solution requires back-end servers having high bandwidth and is effective when dealing with a lot of requests.

What I would like would be to spread a single http request over multiple servers in order to cumulate bandwidth. Looking for a way to do this, I discovered the concept of http request by range.

Is it possible to make nginx splitting a main http request in smaller http range requests spread over mirrored-servers? I prefer to avoid rewriting all web scripts making them doing the job.

share|improve this question
    
Have you looked in the nginx documentation for this? Web search? –  Andrew Schulman Jan 4 at 20:50
    
Yes, I have been searching for more than a hour but what's your point, did you find any relevant documentation about this? I found stuff about the slice module of Nginx and about optimizing the TLS time to First Byte mainly. –  webanck Jan 6 at 10:03

1 Answer 1

This is possible using Nginx' mod_lua, but it might be rather complicated to implement and require a lot of changes to the backend application, because your backends will need to be able to respond with parts of the page that Nginx can put together. It will require you to write lua scripts in the Nginx configuration to collect the output of multiple backends (this can be done in parallel) and then merge them into a single response.

Alternatively, you could also directly use OpenResty, you can get it from here. It's a modification of Nginx which has been done mostly by the authors of mod_lua and it's very well suited for the kind of requirement that you have.

In order to do multiple backend requests in parallel, you will need to use ngx.location.capture_multi in your lua scripts. This is an example to show the syntax:

res1, res2, res3 = ngx.location.capture_multi{
    { "/foo", { args = "a=3&b=4" } },
    { "/bar" },
    { "/baz", { method = ngx.HTTP_POST, body = "hello" } },
}

You can find a more extensive documentation about it's syntax here.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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