2011/12/9, daniels <danie...@gmail.com>:
2011/12/9, jaceka...@gmail.com <jaceka...@gmail.com>:
This is a bit misleading. SQLite is fine for larger applications
(FreeSWITCH, for example, uses it heavily). It's not so fine for
distributed applications or applications with high concurrency levels.
The fact that Tornado is async doesn't mean it's "made for large
applications". It means it scales predictably from small to large. In
fact, Tornado is excellent for small applications, since it has a
relatively small memory footprint.
The fact that Tornado is async is actually something that can make
SQLite more appropriate, since you can be certain that there will only
be a single thread accessing the database at a time (running multiple
instances of Tornado and sharing the same SQLite database would bring
concerns).
> the module that tornado includes is made for MySql, but even this, i
> think it's not made for non-blocking writing on DB, you should look
> for other solutions like MongoDB or Redis (both are NoSql)....
NoSQL databases may or may not be more appropriate for the OP's
application, but this would have more to do with the type of data he is
storing and how it must be retrieved than with whether or not the
database is "non-blocking". NoSQL is *not* a replacement or alternative
for an RDBMS, any more than a filesystem is. You can sometimes use them
interchangeably (usually with some ugliness), but they are intended for
different purposes.
Cliff
Thanks.
2011/12/9, Srini Kommoori <vas...@gmail.com>:
And as you can imagine, a singleton ioloop blocked by SQLite is not a good thing.
The easiest cop-out way is to run multiple tornado instances behind a proxy (nginx/haproxy).
Hope that helps.
- Didip -
Erased everything I just said.
- Didip -
if you could reduce the listen queue down to 1, then nginx or haproxy
in front of multiple tornado's should load balance evenly. the key is
for a 'full' tornado to fast fail and send a TCP RST to the proxy
which could then move the request to another tornado backend.
2011/12/10, Srini Kommoori <vas...@gmail.com>:
Sorry didn't get what you are talking about. Are you implying, during writes db is locked and can't do reads?
Architectural decision that needs to be made about number of concurrent users, db latency and any other constraints project may have.
-Srini
It isn't really necessary to be completely non-blocking. You just need
to be certain you don't block over some threshold. In other words, if
you have a MySQL query that takes 2s, then you should probably find a
way to make it called in a non-blocking fashion. But if the query only
takes 0.01s, then the overhead involved in making it non-blocking
probably isn't worth it.
As I understand it, FriendFeed (which Tornado was written for) does
exactly this. Most of their MySQL queries are blocking and they just
make sure those queries return in a reasonably short amount of time.
Cliff
2011/12/10, Cliff Wells <cl...@develix.com>:
This is what I've been attempting to explain to you. It is fine to
block so long as you are blocking for a very short time. If you read
and understand that entire page, then what you will come away with is
there is no "blocking is better" or "async is better". Rather you will
need to assess your own application and decide "what is good enough" for
your particular circumstances (and in fact, for each database query).
Cliff
I don't think there's been any empirical claim that NoSQL is faster than
an RDBMS except perhaps for very narrowly defined workloads. It's a
different data model that lends itself to particular types of
applications. Many queries cannot even be directly mapped between the
two systems. Comparing NoSQL to an RDBMS is comparing apples and apple
pie.
> so why
> the use of non-blocking since it dont use JOIN to take several
> seconds, and the use of another Async library (for example AsyncMongo)
> will use the native driver, mean there will be twice and
> interpretation of the code, and this will take time no? so why not
> using directly Pymongo (in the case of mongodb, because Pymongo is the
> driver, and asyncmongo is build on pymongo)
A NoSQL query might certainly take several seconds depending on many
variables such as size of the record, load on the server, latency of the
network, etc. You are attempting to make generalizations about systems
that defy generalization. Things such as benchmarks can help setting
some baseline expectations, but at the end of the day, the performance
of your application will rest entirely upon things that are unique to
your application.
Cliff
@Joe: so pymongo is faster?
Because for some applications (not all), it may be needed. Also, some
people simply prefer to keep their async applications "pure", even if it
provides no tangible performance benefit.
Cliff
use pymongo when it's simple queries
use asyncmongo for mapreduce and complex queries
2011/12/17, Phil Whelan <phi...@gmail.com>: