Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Seems that 8Mb is the OSX default.

To avoid errors when starting up statsd, let's lower
the default to 8Mb. Thanks to Aditya Ivaturi (aditya at topsy com)
  • Loading branch information...
commit b4c91056691338ca72b545ddd9edc50a34194345 1 parent 9c39a5a
@cosimo authored
Showing with 7 additions and 5 deletions.
  1. +7 −5 lib/Net/Statsd/Server.pm
View
12 lib/Net/Statsd/Server.pm
@@ -29,9 +29,10 @@ use constant {
DEFAULT_CONFIG_FILE => 'localConfig.js',
DEFAULT_FLUSH_INTERVAL => 10000,
DEFAULT_LOG_LEVEL => 'info',
+ RECEIVE_BUFFER_MB => 8,
};
-our $VERSION = '0.09_01';
+our $VERSION = '0.09_02';
our $logger;
# }}}
@@ -644,10 +645,11 @@ sub start_server {
);
# Bump up SO_RCVBUF on UDP socket, to buffer up incoming
- # UDP packets, to avoid massive packet loss when load
- # is very high.
- setsockopt($self->{server}->fh, SOL_SOCKET, SO_RCVBUF, 16*1024*1024)
- or die "Couldn't set SO_RCVBUF: $!";
+ # UDP packets, to avoid significant packet loss under load.
+ # Read more: http://bit.ly/10eeFoE
+ setsockopt($self->{server}->fh, SOL_SOCKET,
+ SO_RCVBUF, RECEIVE_BUFFER_MB * 1048576)
+ or die "Couldn't set SO_RCVBUF: $!";
# Management interface (TCP, for 'stats' command, etc...)
$self->{mgmtServer} = AnyEvent::Socket::tcp_server $mgmt_host, $mgmt_port, sub {
Please sign in to comment.
Something went wrong with that request. Please try again.