Skip Menu |

This queue is for tickets about the Net-Statsd CPAN distribution.

Report information
The Basics
Id: 78863
Status: resolved
Priority: 0/
Queue: Net-Statsd

People
Owner: cosimo [...] cpan.org
Requestors: TIMB [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: (no value)
Fixed in: (no value)



Subject: Net::Statsd could be much more efficient
For every single send() Net::Statsd does much more work than it needs to because it creates and destroys a socket every single time. The cost is high. All these system calls: open("/etc/hosts", O_RDONLY|O_CLOEXEC) = 19 fstat(19, {st_mode=S_IFREG|0444, st_size=5429, ...}) = 0 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f5666607000 read(19, "################################"..., 4096) = 4096 read(19, "om\ttinyproxy07\t; git\n10.16.252.2"..., 4096) = 1333 read(19, "", 4096) = 0 close(19) = 0 munmap(0x7f5666607000, 4096) = 0 socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP) = 19 ioctl(19, SNDCTL_TMR_TIMEBASE or TCGETS, 0x7ffff70be160) = -1 EINVAL (Invalid argument) lseek(19, 0, SEEK_CUR) = -1 ESPIPE (Illegal seek) ioctl(19, SNDCTL_TMR_TIMEBASE or TCGETS, 0x7ffff70be160) = -1 EINVAL (Invalid argument) lseek(19, 0, SEEK_CUR) = -1 ESPIPE (Illegal seek) fcntl(19, F_SETFD, FD_CLOEXEC) = 0 connect(19, {sa_family=AF_INET, sin_port=htons(8125), sin_addr=inet_addr("127.0.0.1")}, 16) = 0 getpeername(19, {sa_family=AF_INET, sin_port=htons(8125), sin_addr=inet_addr("127.0.0.1")}, [16]) = 0 getpeername(19, {sa_family=AF_INET, sin_port=htons(8125), sin_addr=inet_addr("127.0.0.1")}, [16]) = 0 sendto(19, "logsender.type-.status-200:1|c", 30, 0, NULL, 0) = 30 close(19) = 0 could be reduced to just one: sendto(19, "logsender.type-test.status-200:1|c", 30, 0, NULL, 0) = 30
Show quoted text
> For every single send() Net::Statsd does much more work than it needs > to because it creates and destroys a socket every single time.
Hi Tim, thanks for getting in touch. Yes, I agree. It was a side project for me, so I put it together very quickly and wanted to keep it simple. I'll look into it during the weekend. -- Cosimo
I could fork on github and work on this if you'd like. Let me know.
Subject: Re: [rt.cpan.org #78863] Net::Statsd could be much more efficient
Date: Thu, 09 Aug 2012 15:09:10 +0200
To: bug-Net-Statsd [...] rt.cpan.org
From: "Cosimo Streppone" <cosimo [...] streppone.it>
Show quoted text
> I could fork on github and work on this if you'd like. Let me know.
Sure. That'd be great. Even faster :) -- Cosimo
0.08, already on CPAN, includes Tim's contribution.