Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: ModPerl: ModPerl

nginx load balance

 

 

ModPerl modperl RSS feed   Index | Next | Previous | View Threaded


peng.kyo at gmail

Jun 28, 2008, 6:48 AM

Post #1 of 12 (2075 views)
Permalink
nginx load balance

Hello,

We have some modperl application servers.
Follow the suggestion on this list, I will use a nginx in front of
them to do the load balance.
But I have a question, does nginx support for session-keeping?
A user's request, should go always to the same original backend server.
Otherwise the user's session will get lost.

Thanks!

--
Regards,
Jeff. - Peng.Kyo[at]gmail.com


deepfryed at gmail

Jun 28, 2008, 7:14 AM

Post #2 of 12 (2028 views)
Permalink
Re: nginx load balance [In reply to]

http://wiki.codemongers.com/NginxHttpUpstreamModule

IP hash based distribution is probably what you want

On 6/28/08, Jeff Peng <peng.kyo[at]gmail.com> wrote:
> Hello,
>
> We have some modperl application servers.
> Follow the suggestion on this list, I will use a nginx in front of
> them to do the load balance.
> But I have a question, does nginx support for session-keeping?
> A user's request, should go always to the same original backend server.
> Otherwise the user's session will get lost.
>
> Thanks!
>
> --
> Regards,
> Jeff. - Peng.Kyo[at]gmail.com
>


peng.kyo at gmail

Jun 28, 2008, 7:20 AM

Post #3 of 12 (2039 views)
Permalink
Re: nginx load balance [In reply to]

On Sat, Jun 28, 2008 at 10:14 PM, <deepfryed[at]gmail.com> wrote:
> http://wiki.codemongers.com/NginxHttpUpstreamModule
>
> IP hash based distribution is probably what you want

Thanks.Source IP hash sounds a possible way.
But, if user's gateway (for local network) has a IP pool, it means the
first time user's request was outgoing with IP 11.11.11.11, but next
time the request maybe will go out with IP 22.22.22.22.
How about this case?

--
Regards,
Jeff. - Peng.Kyo[at]gmail.com


deepfryed at gmail

Jun 28, 2008, 7:03 PM

Post #4 of 12 (2016 views)
Permalink
Re: nginx load balance [In reply to]

If you're looking for cookie based session affinity, i suggest you
also look at apache+mod_proxy.
You can specify 'stickysession' which is the name of the cookie or
request param used for session.

Cheers,
Bharanee


yu.pats at gmail

Jun 29, 2008, 12:06 AM

Post #5 of 12 (2015 views)
Permalink
Re: nginx load balance [In reply to]

nginx as a light http\smtp server. It does not do any specific request
logic - it specially designed to minimize request cycle times.

On Sun, Jun 29, 2008 at 5:03 AM, <deepfryed[at]gmail.com> wrote:
> You can specify 'stickysession' which is the name of the cookie or
> request param used for session.
>
That's right!

--
WBR, Yuri Pac


perrin at elem

Jun 29, 2008, 1:50 PM

Post #6 of 12 (1993 views)
Permalink
Re: nginx load balance [In reply to]

On Sat, Jun 28, 2008 at 9:48 AM, Jeff Peng <peng.kyo[at]gmail.com> wrote:
> But I have a question, does nginx support for session-keeping?
> A user's request, should go always to the same original backend server.
> Otherwise the user's session will get lost.

I would advise you not to do this. It's a non-scalable design. If
you need to keep session data beyond what will fit in an encrypted
cookie, you'd be better off storing it in a shared database. That
way, if you lose one of your web servers, the session won't get lost.

- Perrin


js5 at sanger

Jun 30, 2008, 12:18 AM

Post #7 of 12 (1988 views)
Permalink
Re: nginx load balance [In reply to]

On Sun, 29 Jun 2008, Perrin Harkins wrote:

> On Sat, Jun 28, 2008 at 9:48 AM, Jeff Peng <peng.kyo[at]gmail.com> wrote:
>> But I have a question, does nginx support for session-keeping?
>> A user's request, should go always to the same original backend server.
>> Otherwise the user's session will get lost.
>
> I would advise you not to do this. It's a non-scalable design. If
> you need to keep session data beyond what will fit in an encrypted
> cookie, you'd be better off storing it in a shared database. That
> way, if you lose one of your web servers, the session won't get lost.

I would consider using a shared memory solution to save traffic too
from the database server (consider a solution based on memcached??)...
I would be very careful about going back to a single machine for each
request - due to traffic profiles (when a user makes a request there
is a "spike" of requests from the session - all these then get handled
by one machine and not load balanced)...




--
The Wellcome Trust Sanger Institute is operated by Genome Research
Limited, a charity registered in England with number 1021457 and a
company registered in England with number 2742969, whose registered
office is 215 Euston Road, London, NW1 2BE.


perrin at elem

Jun 30, 2008, 5:43 AM

Post #8 of 12 (1991 views)
Permalink
Re: nginx load balance [In reply to]

On Mon, Jun 30, 2008 at 3:18 AM, James Smith <js5[at]sanger.ac.uk> wrote:
> I would consider using a shared memory solution to save traffic too
> from the database server (consider a solution based on memcached??)...

No, don't use memcached for sessions. It's a cache, not a database.
It trades reliability for speed.

- Perrin


peng.kyo at gmail

Jun 30, 2008, 8:00 AM

Post #9 of 12 (1985 views)
Permalink
Re: nginx load balance [In reply to]

Thanks for all.
what's the standard module for storing sessions in a database?

On Mon, Jun 30, 2008 at 8:43 PM, Perrin Harkins <perrin[at]elem.com> wrote:
> On Mon, Jun 30, 2008 at 3:18 AM, James Smith <js5[at]sanger.ac.uk> wrote:
>> I would consider using a shared memory solution to save traffic too
>> from the database server (consider a solution based on memcached??)...
>
> No, don't use memcached for sessions. It's a cache, not a database.
> It trades reliability for speed.

--
Regards,
Jeff. - Peng.Kyo[at]gmail.com


perrin at elem

Jun 30, 2008, 8:07 AM

Post #10 of 12 (1986 views)
Permalink
Re: nginx load balance [In reply to]

On Mon, Jun 30, 2008 at 11:00 AM, Jeff Peng <peng.kyo[at]gmail.com> wrote:
> what's the standard module for storing sessions in a database?

I recommend CGI::Session.

- Perrin


peng.kyo at gmail

Jun 30, 2008, 8:09 AM

Post #11 of 12 (1985 views)
Permalink
Re: nginx load balance [In reply to]

On Mon, Jun 30, 2008 at 11:07 PM, Perrin Harkins <perrin[at]elem.com> wrote:
> On Mon, Jun 30, 2008 at 11:00 AM, Jeff Peng <peng.kyo[at]gmail.com> wrote:
>> what's the standard module for storing sessions in a database?
>
> I recommend CGI::Session.
>

Yes, currently I'm also using CGI::Session.
How about Apache::Session? Is it more efficient under modperl?

--
Regards,
Jeff. - Peng.Kyo[at]gmail.com


perrin at elem

Jun 30, 2008, 8:12 AM

Post #12 of 12 (1988 views)
Permalink
Re: nginx load balance [In reply to]

On Mon, Jun 30, 2008 at 11:09 AM, Jeff Peng <peng.kyo[at]gmail.com> wrote:
> How about Apache::Session? Is it more efficient under modperl?

No, it's about the same, and CGI::Session is better maintained. Don't
be fooled by the name: CGI::Session works well with mod_perl.

- Perrin

ModPerl modperl RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.