> > Lets have a little poll, what databases are you using with Mojolicious? > And which modules are you currently using to access them? >
MySQL... my perception is that we lack solid non-blocking solutions in that arena, so I have rolled some of my own, which I hope to make available once they take on a more solid form: I have a Mojo-based MySQL/JSON REST "gateway" (somewhat reminiscent of DBSlayer, it's technically more of a DBI/JSON gateway, with actions named after DBI method calls), speaks JSON, uses blocking calls to DBI, runs under Hypnotoad with one client (and one DBI connection) per process, and it's accessed via nonblocking Mojo::UserAgent calls from the application, which is either in a different process or on an entirely different server. This one is used in production. I've also been toying with a this same basic model, but a MySQL/JSON helper process that uses blocking DBI calls from perl threads, speaking JSON on STDIN/STDOUT. The application spawns and communicates with this code, non-blocking, via Mojo::IOLoop::ReadWriteFork. Each database request is assigned an opaque identifier on the application side, which is returned with the response by the gateway, allowing concurrent queries to be run and disambiguated (the callback for the response is mapped to the opaque ID). And I've played around a bit with the idea of a new pure-perl non-blocking MySQL interface using Mojo::IOLoop::Client. Lots of interesting challenges, there, but if it can perform, I think this would be my ideal solution. Of course, in some cases, I just use DBI and wait. Also, there's Memcache... which isn't what you'd typically think of as a "database," but we do have a web platform which, in QA mode, uses memcache as its session store. For a sidecar Mojolicious application that needs to access this session store, I wrote a plugin that uses Mojo::IOLoop::Client and has a ground-up implementation of a subset of the memcache text protocol. Currently, it only supports "get" (of single keys) and "version," (for keepalives) but that's what I needed. It's also non-blocking and can have multiple queries simultaneously in-flight on one connection. MySQL introduced a memcache interface to InnoDB in 5.6... I haven't tested my code against it, yet, but this seems like it could also have interesting implications for simple, quick, lightweight, nonblocking database key/value lookups from MySQL down the road. -- You received this message because you are subscribed to the Google Groups "Mojolicious" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/mojolicious. For more options, visit https://groups.google.com/d/optout.
