Sometimes, when using threads, an error raises from time to time (but is very difficult to see):
Traceback (most recent call last):
File "/usr/local/lib/python2.6/dist-packages/bjsonrpc/proxies.py", line 43, in function
return self._conn.proxy(self.sync_type, name, args, kwargs)
File "/usr/local/lib/python2.6/dist-packages/bjsonrpc/connection.py", line 608, in proxy
req = Request(self, data)
File "/usr/local/lib/python2.6/dist-packages/bjsonrpc/request.py", line 68, in __init__
File "/usr/local/lib/python2.6/dist-packages/bjsonrpc/connection.py", line 285, in addrequest
assert(request.request_id not in self._requests)
Taking a look onto the code, i’ve found that the id-generation function allows to be executed concurrently, allowing to return duplicates. I added a bugfix which ensure only one call is given at a time. I hope this is enough to avoid the bug.
Hey, was a long time ago, some months from now on, but now it’s the time to publish a new release of bjsonrpc. In this new version, several improvements were made:
- Corrected connection timeouts for better connection stability over Wireless
- Added a shutdown method to handlers to make possible the customization of the closing process of the object.
- Better error reporting when adding the function twice to the handler or when something goes wrong in json.dumps
- Added a threading option to server and client.
- Added some locks that makes possible the use of bjsonrpc with threads.
With these changes and with the latest test i have done with bjsonrpc, I could say that bjsonrpc is almost stable.
Download it at:
These days i’m trying WSGI technologies with python. I was used to PHP, Apache/Lighttpd, FastCGI and these kind of things. But i felt that python was more powerful and could be a lot faster than PHP. I tried Django in the past, but it was a madness inside the framework. Django is very powerful, but you’re inside of a kind of jail, you can play inside and is very fast and pretty, but doing non-standard things is a problem. And the main problem was distributing or migrate your app to another server, that’s a hell. But i learned that Python can be much faster than PHP.
Now i’m wondering about WSGI, it’s new for me, i believe Django uses WSGI inside, and seems to be a cool technology for web applications.
When i decided to not support HTTP in bjsonrpc, the main reason was performance. HTTP includes lots of data in each call, and one single call (send, receive) is done using the same connection. That is a lot of overhead in bandwidth, connection and CPU. But HTTP is great for other things that doesn’t require that performance. And i’m wondering about if it’s possible to use bjsonrpc under wsgi; but some features would be problematic because HTTP doesn’t handle more than one request per connection.
I don’t know if these could be handled using jsonprc v2 protocol, with an array of queries, or using cookies.
Anyway, the basic performance i got with WSGI (with a hello wolrd in python) is about 500 request per second, using Apache + mod_wsgi. Is pretty fast. (But using raw sockets in python is faster, of course)
So the conclusion is, WSGI is a good option to port bjsonrpc to HTTP.
Great news! Today i’ve received a mail telling me that softpedia has included this library, only two days after submitting it on the PyPi repo.
There is: http://linux.softpedia.com/get/Programming/Libraries/bjsonrpc-64290.shtml
We’re proud to announce our first release of bjsonrpc version 0.1.1
Check it out here:
This is the new blog for the bjsonrpc project.
Here we will publish news articles related about bjsonrpc project and related topics.