2
0
mirror of https://opendev.org/x/pyghmi synced 2025-01-28 20:07:42 +00:00

Reduce cost of packet transmit

eventlet only cares about multiple readers.  Multiple threads doing send
do not bother it.  As such, just call the sendto directly rather
than going through the hoop of an io_apply and the associated
event creation and wait and general confusion of jumbling
up the IO worker thread.  This seems to buy about 10%
performance gain in the ~100 server scenario doing get_health.

Change-Id: Ia671f201a43f32589324b37aadf79f21548aef35
This commit is contained in:
Jarrod Johnson 2015-02-18 14:49:14 -05:00
parent f0d3050a79
commit cdef6531ca

View File

@ -1476,8 +1476,7 @@ class Session(object):
_monotonic_time()
return # skip transmit, let retry timer do it's thing
if self.sockaddr:
_io_apply(_io_sendto,
(self.socket, self.netpacket, self.sockaddr))
_io_sendto(self.socket, self.netpacket, self.sockaddr)
else: # he have not yet picked a working sockaddr for this connection,
# try all the candidates that getaddrinfo provides
self.allsockaddrs = []
@ -1493,8 +1492,7 @@ class Session(object):
sockaddr = (newhost, sockaddr[1], 0, 0)
self.allsockaddrs.append(sockaddr)
Session.bmc_handlers[sockaddr] = self
_io_apply(_io_sendto, (self.socket,
self.netpacket, sockaddr))
_io_sendto(self.socket, self.netpacket, sockaddr)
except socket.gaierror:
raise exc.IpmiException(
"Unable to transmit to specified address")