回复: Re: How to
Haifeng Liu
haifeng.813 at gmail.com
Tue Jan 22 13:33:31 UTC 2013
=?UTF-8?Q?bind_variable_with?=
=?UTF-8?Q?_connection_in_a_customized_module=3F?=
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
Thank you very much. And for your note, I know the connections are reusable=
, it's not a problem for me. To be sure, during a client is alive, the conn=
ection won't serve other clients, is it correct?
Maxim Dounin <mdounin at mdounin.ru>=E7=BC=96=E5=86=99=EF=BC=9A
Hello!
On Tue, Jan 22, 2013 at 08:16:36PM +0800, Liu Haifeng wrote:
> hi all,
>=20
> I want save state during a long connection (keep-alive) for=20
> performance optimization in my own HTTP handler module, thus I=20
> can peek up the saved state when handling requests, to speed up=20
> response. Actually it's quite like session concept. I saw=20
> request struct has a member ctx, but what I want is a ctx on the=20
> connection. It seems no way to save any customized variable to=20
> the ngx_connection_t structure. What's the suggested way to make=20
> this if I don't want the client hold something like session_id?
This was recently discussed on nginx-devel@ mailing list, and=20
probably the best way currently available is to install connection=20
pool cleanup handler with custom data and then iterate over=20
connection pool cleanup handlers to find your data. It is=20
relatively costly, but allows to keep memory footprint from=20
keepalive connections low and still allows modules to keep their=20
per-connection data in rare cases when they really need to.
See here:
http://mailman.nginx.org/pipermail/nginx-devel/2012-December/003049.html
Note well though, that HTTP is stateless protocol, and the fact=20
that request came from the same connection means mostly nothing:=20
it might be a request from a completely different user.
--=20
Maxim Dounin
http://nginx.com/support.html
_______________________________________________
nginx mailing list
nginx at nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
More information about the nginx
mailing list