HOWTO: Increase performance when using SSL

Get help with all aspects of SABnzbd
Forum rules
Help us help you:
  • Are you using the latest stable version of SABnzbd? Downloads page.
  • Tell us what system you run SABnzbd on.
  • Adhere to the forum rules.
  • Do you experience problems during downloading?
    Check your connection in Status and Interface settings window.
    Use Test Server in Config > Servers.
    We will probably ask you to do a test using only basic settings.
  • Do you experience problems during repair or unpacking?
    Enable +Debug logging in the Status and Interface settings window and share the relevant parts of the log here using [ code ] sections.
Post Reply
quixote
Newbie
Newbie
Posts: 2
Joined: November 22nd, 2012, 6:16 am

HOWTO: Increase performance when using SSL

Post by quixote »

Hi All,

I just started playing around with this great package but discovered I was only getting 4.4MB/s over my 100Mbps broadband connection!
This was after tweaking things like article caching - which helped, but not enough!

Looking at top, I noticed that SABnzbd was at 100% on one of my cores (sometimes exceeding but rarely), so I figured the major bottleneck is CPU, but I have a spare core
(on my old Core2 Duo). So how do I workaround the Python GIL - which effectively forces the single core nature of the interpreter...

As I'm using SSL, I figured that even though I have pyOpenSSL install (so it should be using compiled code for SSL rather than interpreted), maybe offloading the SSL handling to a separate process would help...enter stunnel. This little utility enables you to configure a local port to be forwarded over SSL to a remote host/port. Thus a quick reconfigure of SABnzbd to use a local ntp server without SSL, but stunnel to relay that connection to my news server, and additionally provide the SSL.

Now I'm seeing about 70-80% of one core used by stunnel and 70-80% of the other core is used by SABnzbd, but more importantly, I'm seeing d/l speeds of 12.5MB/s!

Hope this helps anyone else using limited or old h/w.
User avatar
shypike
Administrator
Administrator
Posts: 19773
Joined: January 18th, 2008, 12:49 pm

Re: HOWTO: Increase performance when using SSL

Post by shypike »

quixote wrote:So how do I workaround the Python GIL - which effectively forces the single core nature of the interpreter...
You cannot.
Indeed, your stunnel approach is a good solution.
Unfortunately not one we can integrate into SABnzbd, given all OS dependencies.
For more powerful platforms it's not really needed.
quixote
Newbie
Newbie
Posts: 2
Joined: November 22nd, 2012, 6:16 am

Re: HOWTO: Increase performance when using SSL

Post by quixote »

Hmm, maybe I should knock together a Python implementation of stunnel using pyOpenSSL - would still provide the core offload capabilities

Fair point on stunnel not being one to integrate in this package (I wasn't expecting it to be) - I just wanted to suggest a workaround for people in a similar position to me.

Anyway, great work on this - I am really impressed by the ease of use and flexibility - plus i like Python :)
Now we just need some enhancements to pypy as that would give me all the performance i need :D
User avatar
shypike
Administrator
Administrator
Posts: 19773
Joined: January 18th, 2008, 12:49 pm

Re: HOWTO: Increase performance when using SSL

Post by shypike »

I've looked at alternative Python implementations.
Problem number one: they all break important libraries that SABnzbd depends on.
A multi-processing approach may work, but requires very substantial redesigns.
Post Reply