ajax data server, which languages/libraries should i use
I'm developing a http server that takes ajax requests from the browser,
fetches data from the database and returns it in json format. The data is
fetched from mysql and redis. I've developed a basic proof of concept with
python using tornado. The problem is that tornado is blocking on multiple
requests, so if request #1 comes in and takes 3 seconds, and then request
#2 comes in at the same time, it will wait those 3s to even begin working.
This is causing a negative user experience on the front end that we can't
have.
The requests are data heavy in nature, meaning the bulk of the python
execution is spent waiting for mysql to return. The actual work done by
python is very light; it will just format what's returned and throw it in
the json object being returned. There is a reasonably complicated mysql
query and only a few lines of python around it to manage it.
I have a demo with tornado working, but it seems I have to rewrite parts
of the mysql driver to get it to work asynchronously with mysql. That
sounds difficult and risky. I'm looking into gevent currently, but it
seems that most things python work synchronously with mysql regardless of
the library or tool used.
What are the best tools for me to use to develop this. The main thing I
want is that simultaneous requests are handled concurrently. I don't want
one request from one user cause another user to wait. I've found python to
be very difficult to wield to be asynchronous. Are there other python
tools that I should use? Does anybody have an example of handling a mysql
heavy http request asynchronously?
Is php/apache out of the question? We went away from php because python is
generally supposed to perform better (though that's not what I've found
here and here. Does the language/tool really matter when you're mostly
bottlednecked by the data fetch anyway?
Thanks for your thoughts guys!
No comments:
Post a Comment