maximum connections ignored?

Steven Grimm sgrimm at facebook.com
Mon Mar 19 06:45:27 UTC 2007


I think all the "-c" option is really intended for is to *increase* the 
connection limit above the OS's default setting. For example, we run our 
memcached instances with "-c 80000". I have to admit the idea of using 
it to *lower* the limit had never even occurred to me! But yeah, I guess 
the documentation doesn't say you can't do that, so it ought to work as 
advertised. Maybe someone somewhere wants to set a low limit on open 
connections as a security measure or something (grasping at straws; I 
can't actually think of any reason at all I'd ever want to do that.)

Speaking of which, I think the default should be to set it to the 
maximum value the OS will allow. What do people think of that? Are there 
OSes out there (that people are running memcached on, anyway) where 
setting the file descriptor limit really high can cause problems or 
increased resource consumption even if you don't ever actually get that 
many open connections? Any other downsides people can think of?

-Steve


Paul Lindner wrote:
> I just wrote the following test case, which fails.  It appears that
> we do not check against the maximum connection amount specified on the
> command line.
>
> I think it's an easy fix in conn_new().
>
> Thoughts?
>
>
>
>
> [lindner at mirth server]$ more t/maxconns.t
> #!/usr/bin/perl
>
> use strict;
> use warnings;
>
> use Test::More tests => 20;
>
> use FindBin qw($Bin);
> use lib "$Bin/lib";
> use MemcachedTest;
>
>
> # start up a server with 10 maximum connections
> my $server = new_memcached('-c 10');
> my $sock = $server->sock;
> my @sockets;
>
> ok(defined($sock), 'Connection 0');
> push (@sockets, $sock);
>
> foreach my $conn (1..20) {
>   $sock = $server->new_sock;
>   if ($conn > 10) {
>     ok(!defined($sock), "Failed Connection $conn $sock");
>   } else {
>     ok(defined($sock), "Connection $conn");
>     push(@sockets, $sock);
>   }
> }
>
>
>   



More information about the memcached mailing list