Archived Forum Post

Index of archived forum posts

Question:

High CPU usage with Python SSH module

Oct 24 '16 at 13:04

Good day, I really like Python SSH module, however it eats 100% CPU, when I try to connect to multiple servers in threads(even 10-15 threads). Both Win and Linux. Is there a way to reduce it? The most simple example I stitched up:

import chilkat, threading, time

def Connect():        
    ssh = chilkat.CkSsh()    
    if not ssh.Connect('Host', 22) : return        
    ssh.put_IdleTimeoutMs(5000)        
    if not ssh.AuthenticatePw('user', 'pw'): return

chilkat.CkSsh().UnlockComponent("Anything for 30-day trial")    
for _ in range(15):
    threading.Thread(None, Connect).start()        
while threading.active_count() > 1:
    time.sleep(1)