# HTTP Keepalive @Maxim Dounin

**URL:** <https://www.ruby-forum.com/t/http-keepalive-maxim-dounin/209327>\
**Category:** NGINX\
**Created:** [July 11, 2011, 11:07pm UTC](https://www.ruby-forum.com/t/http-keepalive-maxim-dounin/209327 "2011-07-11T23:07:06Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [July 11, 2011, 11:07pm UTC](https://www.ruby-forum.com/t/http-keepalive-maxim-dounin/209327/1 "2011-07-11T23:07:06Z")

</div>

Today I read through the code of the  
[http://mdounin.ru/hg/ngx\_http\_upstream\_keepalive/](http://mdounin.ru/hg/ngx_http_upstream_keepalive/)

Although my understanding of nginx internals is limited, I did C  
programming  
back in my youth. From my understanding of the code there is very little  
modification needed in order to add HTTP (backend HTTP/1.1) keep alive.

As I see it to complete this the protocol has to be updated to the  
version  
of 1.1 and the “Connection: keep-alive” header needs to be added to  
responses, this would add very basic keep alive support to nginx I would  
beleive (please do correct me if I am wrong)

To make the modifications howeaver it would be necessary to edit the  
nginx  
source (or make a new http backend plugin, which could be mostly copy  
and  
paste) – I would be more specific on this matter but [nginx.org](http://nginx.org) is down  
currently and im not able to get the latest version of the source to  
look  
at.

Would it be possible for someone with a knowledge of nginx internals to  
take  
a look at this and tell me if I am going about this the correct way? I  
am  
going to fiddle a bit and see if I can produce a plugin once [nginx.org](http://nginx.org)  
comes  
back up.

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [July 12, 2011, 4:00am UTC](https://www.ruby-forum.com/t/http-keepalive-maxim-dounin/209327/2 "2011-07-12T04:00:31Z")

</div>

Hi, Maxim!

On Tue, Jul 12, 2011 at 5:50 AM, Maxim D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> The fun starts somewhere near “the protocol has to be updated to  
> the version of 1.1”. My current diff is something like “7 files  
> changed, 688 insertions(+), 29 deletions(-)” and still growing.

So…if I read it correctly, you’re already actively working on the  
HTTP 1.1 protocol support for ngx\_http\_proxy\_module? I’m asking  
because I’ve been planning to do this in August. If you’re already on  
it, then there’s no need to duplicate the efforts on my side and I can  
work on something else 😉

Thanks!  
-agentzh

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [July 12, 2011, 4:41am UTC](https://www.ruby-forum.com/t/http-keepalive-maxim-dounin/209327/3 "2011-07-12T04:41:52Z")

</div>

Your working on 1.1 support? Yay for me not needing to work on it. I was  
going to give it an attempt but judging by the number of inserts I  
probably  
would have failed.

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [July 12, 2011, 5:49am UTC](https://www.ruby-forum.com/t/http-keepalive-maxim-dounin/209327/4 "2011-07-12T05:49:09Z")

</div>

Hi Maxim,

Are you developing the HTTP/1.1 proxy module? Great news.

I’m just collecting your old patch and developing a new patch for  
backend  
keepalive([https://github.com/yaoweibin/nginx\_upstream\_keepalive\_patch](https://github.com/yaoweibin/nginx_upstream_keepalive_patch) ).  
I  
don’t know if there is any serious problem. My Test Set is too small. If  
you  
find any problem, shoot me.

Thanks.

2011/7/12 Maxim D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [July 11, 2011, 11:50pm UTC](https://www.ruby-forum.com/t/http-keepalive-maxim-dounin/209327/5 "2011-07-11T23:50:58Z")

</div>

Hello!

On Tue, Jul 12, 2011 at 07:06:23AM +1000, SplitIce wrote:

> beleive (please do correct me if I am wrong)  
> 🙂

The fun starts somewhere near “the protocol has to be updated to  
the version of 1.1”. My current diff is something like “7 files  
changed, 688 insertions(+), 29 deletions(-)” and still growing.

> To make the modifications howeaver it would be necessary to edit the nginx  
> source (or make a new http backend plugin, which could be mostly copy and  
> paste) – I would be more specific on this matter but [nginx.org](http://nginx.org) is down  
> currently and im not able to get the latest version of the source to look  
> at.
> 
> Would it be possible for someone with a knowledge of nginx internals to take  
> a look at this and tell me if I am going about this the correct way? I am  
> going to fiddle a bit and see if I can produce a plugin once [nginx.org](http://nginx.org) comes  
> back up.

[nginx.org](http://nginx.org) looks perfectly up from here (and [isup.me](http://isup.me) says the  
same), probably it’s just you.

Maxim D.

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [July 13, 2011, 4:18am UTC](https://www.ruby-forum.com/t/http-keepalive-maxim-dounin/209327/6 "2011-07-13T04:18:42Z")

</div>

Looking foward to seeing it. When its ready for testing feel free to  
post it  
in the nginx group and Ill happily help out 🙂

2011/7/12 Maxim D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [July 12, 2011, 11:24am UTC](https://www.ruby-forum.com/t/http-keepalive-maxim-dounin/209327/7 "2011-07-12T11:24:54Z")

</div>

Hello!

On Tue, Jul 12, 2011 at 09:59:38AM +0800, agentzh wrote:

> HTTP 1.1 protocol support for ngx\_http\_proxy\_module? I’m asking  
> Yes.

Maxim D.
