1

Twisted server supports more than 10,000 concurrent connections. I want to write a test case to check it using Python.

What I know is just using multiprocessing + threading + greenlet. My question is how to confirm Twisted's support for more than 10,000 concurrent connections?

Something I know is using logger, but is logger accurate? Or has other way to calculate it?

Adam Lear
  • 38,111
  • 12
  • 81
  • 101
flreey
  • 405
  • 1
  • 6
  • 9

2 Answers2

4

It's easy to support more than 10,000 concurrent connections. What can be harder is supporting so many active connections. The kind of activity you expect to find on your connections is more likely to determine how many you can support at once. What do you expect these connections to be doing? Construct a test which reflects real world behavior and then see how many clients you can support with it. The more accurately your test reflects real world behavior, the more accurate your results will be.

Jean-Paul Calderone
  • 47,755
  • 6
  • 94
  • 122
  • 1
    +1, this is very true. I've been bitten by assumptions that socket count was the bottleneck, as opposed to socket _activity_. Having sockets wake up constantly is very expensive. – Matt Joiner Nov 29 '11 at 03:11
1

Nicholas Piël's concurrency benchmarks are pretty interesting, and include comparisons of Twisted and other frameworks in Python. He also mentions how to test with socket handles numbering in the 10s of thousands.

Another good read on the subject is The C10K problem, although it doesn't just apply to Python.

By applying the techniques Nicholas uses you'll be able to verify his finds, and determine exactly what level of concurrency performance Twisted will achieve for you.

Matt Joiner
  • 112,946
  • 110
  • 377
  • 526
  • While I appreciate the effort Nicholas has put into this problem, the benchmarks are actually pretty flawed, and due to the request workload, the benchmarks are neither terribly realistic, nor (especially in the "asynchronous servers" one) actually concurrent. The requests are *issued* concurrently, but they're *processed* serially. – Glyph Nov 28 '11 at 19:51