[ZODB-Dev] zeo2a1 performance cold spots

Toby Dickenson tdickenson@geminidataloggers.com
Thu, 27 Jun 2002 17:23:35 +0100


On Wednesday 26 Jun 2002 2:45 pm, Toby Dickenson wrote:
> On Tuesday 18 Jun 2002 6:51 pm, Shane Hathaway wrote:
> > Toby Dickenson wrote:
> > > It might not be significant, but since upgrading my development mac=
hine
> > > to ZEO2 alpha 1 I have noticed that Zope startup is occasionally
> > > significantly slower than normal.
> >
> > Interesting.  So far, I've seen the opposite: my NNTP server, backed =
by
> > ZEO 2, starts up instantly, where it used to take about 2 seconds.
> > (I've hacked ZEO slightly to change its threading model, but I don't
> > think that would make a difference.)
>
> Its a false alarm. I must have added a FORCE_PRODUCT_RELOAD into my zop=
e
> start script at some point.

Ah, no, I was right the first time. FORCE_PRODUCT_RELOAD was causing exce=
ss=20
ZEO traffic, but the traffic was still slower than it should be. As far a=
s I=20
can tell this is due to ZEO not turning on TCP_NODELAY, which adds a litt=
le=20
latency to every request.

This change brings my single machine benchmark up to nearly 100% CPU usag=
e=20
again, as I would expect.

I am hesitant to commit this because it looks like ZEO has always worked =
this=20
way, and I am suprised noone else has seen this effect before. Particular=
ly=20
on windows. Any thoughts?

Index: client.py
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvs-repository/Packages/ZEO/zrpc/client.py,v
retrieving revision 1.2
diff -c -2 -r1.2 client.py
*** client.py   11 Jun 2002 19:22:26 -0000      1.2
--- client.py   27 Jun 2002 16:07:50 -0000
***************
*** 263,266 ****
--- 263,267 ----
                      continue
                  s.setblocking(0)
+                 s.setsockopt(socket.IPPROTO_TCP, 1, 1) # TCP_NODELAY
                  self.sockets[s] =3D addr
                  # connect() raises Connected iff it succeeds
Index: server.py
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvs-repository/Packages/ZEO/zrpc/server.py,v
retrieving revision 1.2
diff -c -2 -r1.2 server.py
*** server.py   11 Jun 2002 19:22:26 -0000      1.2
--- server.py   27 Jun 2002 16:07:50 -0000
***************
*** 42,45 ****
--- 42,46 ----
          else:
              self.create_socket(socket.AF_UNIX, socket.SOCK_STREAM)
+         self.setsockopt(socket.IPPROTO_TCP, 1, 1) # TCP_NODELAY
          self.set_reuse_addr()
          log("listening on %s" % str(self.addr))