in reply to IO::Socket::SSL / Net::SSLeay inefficient in non-blocking mode ?
Your code is expecting to read and write entire 16K chunks, and even throws an error if it doesn't get a full 16K chunk. This goes against the normal API of sysread, though of course in this case it is virtual. Does SSL protocol or this particular implementation guarantee whole frames like this? Is 16K a magic SSL number that you can rely on, or will it sometimes give you smaller chunks? Or does it guarantee that you receive the whole chunks of whatever the other side sent?
Packets have to be smaller than 1.5K for ethernet, so many physical receives will happen before you reach 16K, as you noticed in your subsequent post. Might your choice of 16K be the actual problem that causes lots of looping? You mention configuring the "low water mark" on the socket, but that seems wrong. Your application packets are 16K, but the underlying TCP packets could be a variety of sizes, so insisting at the OS level that it not return data until 16K is available seems likely to break things (even if it didn't this time).
Using Time::HiRes, have you tried measuring the actual overhead of an "unproductive" sysread on IO::Socket::SSL which reads the underlying socket but delivers nothing? How does this compare to the time spent on a productive sysread? It seems to me that an unproductive sysread shouldn't take much longer than a sysread on the underlying socket. If you call ->sysread as a class method instead of a tied-IO global function, is there any performance difference?
Have you verified that the code really does wait on select()? If fileno() didn't work as expected and the select() always returned immediately, it would result in really high CPU usage with no other hints that something was wrong.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: IO::Socket::SSL / Net::SSLeay inefficient in non-blocking mode ?
by Yaribz (Beadle) on Jun 24, 2022 at 09:04 UTC | |
by NERDVANA (Priest) on Jun 24, 2022 at 18:32 UTC | |
by Yaribz (Beadle) on Jun 25, 2022 at 11:19 UTC | |
by NERDVANA (Priest) on Jun 26, 2022 at 03:56 UTC | |
by Yaribz (Beadle) on Jun 26, 2022 at 16:49 UTC | |
| |
by Yaribz (Beadle) on Jun 26, 2022 at 10:13 UTC | |
by Yaribz (Beadle) on Jun 26, 2022 at 12:03 UTC |