Skip to content

Why pycurl?

When building a SPARQL client, HTTP performance matters. Every query involves an HTTP round-trip, and for applications executing thousands of queries, the choice of HTTP library directly impacts throughput.

We benchmarked six popular Python HTTP libraries against a Virtuoso SPARQL endpoint to make an informed decision. The results clearly favor pycurl.

The full benchmark is available at sparql-http-benchmark.

Test setup:

  • Virtuoso SPARQL endpoint running in Docker
  • Python 3.12+
  • 11 runs per test (first run is warmup, discarded)
  • 50 iterations per query type
  • All libraries configured with equivalent connection pooling and 30-second timeouts

Operations tested:

  • Read: SELECT (simple, filtered, with OPTIONAL), ASK, CONSTRUCT
  • Write: INSERT DATA, DELETE DATA, UPDATE (DELETE/INSERT)
LibraryAvg timeRelative
pycurl0.78ms1.0x
aiohttp1.45ms1.9x
urllib31.50ms1.9x
httpx (sync)1.61ms2.1x
requests1.78ms2.3x
httpx (async)2.02ms2.6x

pycurl is 2x faster than httpx and 2.3x faster than requests.

Average time by library

For read-heavy workloads (the typical SPARQL use case), pycurl dominates:

  • 5,846 requests/second for simple SELECT queries
  • 5-6x higher throughput than competitors

Requests per second by query type

Write operations show convergence across all libraries (300-2,000 req/s). This is expected: the database write mechanism becomes the bottleneck, not HTTP client overhead.

Read vs write performance

Performance heatmap