Skip to main content

Computes the optimal interpreter check interval for the machine it is run on. The formula is as follows:

<result of pystone benchmark> / 50

Installation and use

The checkinterval script must be installed into the Python interpreter used to run Zope. This is most easily achieved by adding a part to your buildout.cfg:

[buildout]
parts = checkinterval

[checkinterval]
recipe = zc.recipe.egg
eggs = jarn.checkinterval

After re-running buildout, type:

$ ./bin/checkinterval
1305

The number you see is the recommended check interval for this machine; put it into your zope.conf file:

python-check-interval 1305

Now restart Zope and bask in the glow.

Why care?

The Python Library Reference on the topic of check interval: “This integer value determines how often the interpreter checks for periodic things such as thread switches and signal handlers. The default is 100, meaning the check is performed every 100 Python virtual instructions. Setting it to a larger value may increase performance for programs using threads.”

Now, the Zope application server is such a program, and it benefits greatly from setting the right check interval. If the value is too low, Zope threads are interrupted unnecessarily, causing a noticable performance hit on today’s multi-cpu hardware.

Where’s the 50 coming from?

The constant 50 in the formula was determined by benchmarks performed at Zope Corporation and has become part of the “Zope lore” (See e.g. this post by Matt Kromer). Going beyond pystone/50 produced no further benefits.

The value may well be meaningless for applications other than Zope and platforms other than Intel.

Background

More on check intervals and the GIL from David Beazly.

For those back from the Beazly talk: Zope uses long running threads and asyncore, making it (more) independent from OS scheduling issues. Still, the interruption argument holds.

Changelog

1.0 - 2009-06-13

  • Initial release

Release files for jarn.checkinterval 1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for jarn.checkinterval 1.0
File Size Uploaded
jarn.checkinterval-1.0.zip 8.1 kB Details

Release files / jarn.checkinterval-1.0.zip

Download URL jarn.checkinterval-1.0.zip
Size 8.1 kB
Tags Source
SHA-256 checksum
How to use checksums
d57eca8d4f437f63eb547e6533a66a1b5d96a65348b20a874d1debb1c49d37dc
BLAKE2b-256 checksum
How to use checksums
92a1ac38929f530affa48023f049ca1f4da2d6bd2150deb1c92f833c5dd328de
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

1.0 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page