Metaswitch/crest — pull request #89 by rkd-msw (2013-10-28 13:38:08+00:00)
Title: [Reviewer: Matt] Fix HSS connections on multi-core processors

Matt,

On multi-core processors, Homestead previously spawned one Python process per core. This allowed HTTP connections to be handled faster, but broke HSS connections - each process made its own HSS connection with the same Origin-Host and Origin-Realm. The HSS only acknowledged one of these connections, causing most requests to fail.

This commit forces Homestead to use a single process (and therefore a single HSS connection) in order to fix this. I'm aware that this will reduce HTTP performance on multi-core processors, but I think this is acceptable: however fast the previous behaviour was, it wasn't correct. We can still use dual-core processors quite effectively, as the work is split between Python and Cassandra.

As a long-term fix, the right solution is probably to have a single HSS connection process, and then one process per core handling the HTTP connections and calling into the HSS connection process where necessary. But this is tricky in Python, and adds overhead to systems with fewer cores, so we probably don't want to do it yet (if at all).