UDP locking problems when receiving from multiple senders on same port
----------------------------------------------------------------------
Key: JRUBY-2288
URL: http://jira.codehaus.org/browse/JRUBY-2288
Project: JRuby
Issue Type: Bug
Components: Core Classes/Modules
Affects Versions: JRuby 1.1RC2, JRuby 1.1RC3
Environment: Linux x86, Fedora 8, java version "1.7.0" IcedTea
Reproduced with JRUBY 1.1RC2 and trunk as of March 17
Reporter: Joel Scotkin
Attachments: test.rb, udpTestClient.c
I have some sensor data which is broadcast out over UDP. Multiple sensors
(each of which is a microcontroller with an OS and an IP address) send out UDP
packets back to a given port (1050 in this case) on the main server. Reading
these packets in C or Java is no problem.
I wanted to try using ruby to automate some of our components that require user
interaction. Stock mri could only handle a few udp packets a second. JRuby
was hundreds of times faster for handling a single incoming stream, but hits
what must be a thread or monitor locking problem with a second stream. The
moment the first packet arrives from a second sender throughput handling drops
to just one or two packets per second.
Attached are two files. Test.rb is a minimal ruby UDP listener - it prints the
number of packets it has received, and the payload of the packet.
udpTestClient.c is a small C UDP client which sends out packets which contain
their sequence number. To use, edit both files to set your IP address (use the
real network card - interestingly, the loopback address 127.0.0.1 does not show
the locking issue!). Then run test.rb in one terminal, and start first one,
and then a second copy of udpTestClient (on same machine, or multiple
machines). You'll see that initially the throughput is quite high, and as soon
as the second one starts it basically collapses.
Thanks!
Joel
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email