Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rpyc critical performance issue with BgServingThread #32

Closed
ghost opened this issue Mar 15, 2011 · 2 comments
Closed

rpyc critical performance issue with BgServingThread #32

ghost opened this issue Mar 15, 2011 · 2 comments
Labels
Bug Confirmed bug

Comments

@ghost
Copy link

ghost commented Mar 15, 2011

I work with RPYC classic server (see code below) under Windows XP.

When I have BgServingThread, 100 calls of execute() takes about 10 seconds.
Without BgServingThread, 100 calls of execute() takes about 0.01 seconds.

Why? What can I do to have both BgServingThread running and execute() working fast?

import rpyc 
import time 

c = rpyc.classic.connect("localhost") 
t = rpyc.BgServingThread(c) # delete this line for fast execute

start = time.time() 
for i in range(100): 
    c.execute("newObj = %d" % (i)) 
stop = time.time() 
print "added %d simple objects one by one, %f seconds" % (100, stop - start) 

t.stop()  # delete this line if deleted line above

Need any ideas...

@tomerfiliba
Copy link
Collaborator

have a look at: http://github.com/tomerfiliba/rpyc/blob/v3.0.7/utils/helpers.py#L70 and http://github.com/tomerfiliba/rpyc/blob/v3.0.7/core/protocol.py#L296

the bg server thread calls serve with a timeout of 0.1 seconds each time. while it attempts to serve, no other thread can use the connection, so calls to c.execute (or any other remote invocation, for that matter) have to wait for an average of 0.1 seconds before being able to lock the connection and send their data.

100 calls * 0.1 second delay for lock = 10 seconds.

i will try to find a better way to solve the contention between threads sharing the connection... but it won't happen in 3.1.0

@tomerfiliba
Copy link
Collaborator

closed by e407ada

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Confirmed bug
Projects
None yet
Development

No branches or pull requests

1 participant