March 7, 2005

nssqlite3: SQLite 3 driver for AOLserver

Last night, I spent about three hours implementing nssqlite3. The motivations behind this included the fact that I've been working on a replacement for Movable Type which I currently use to manage my blog, and I've configured MT to use SQLite as its database. I figured it would be nice to be able to use the same database to make migration to Soapbox -- the name of my blogging software package -- easier, for myself and other MT users. But, this means needing a SQLite v3 driver for AOLserver, and the existing SQLite driver from Wojciech Kocjan is nssqlite2, which is for SQLite v2. So, I went ahead and implemented the driver for SQLite v3.

I sent an email to the AOLSERVER mailing list last night announcing the new SQLite database drivers [also: link, link].

I only tested the driver on my primary dev. environment so far, which is a Debian Linux box. I installed the following Debian packages to get SQLite v3: sqlite3 sqlite3-doc libsqlite3-0 libsqlite3-dev. I tested using AOLserver 4.0.10 with the following config. snippet appended to the sample-config.tcl:

#
# SQLite v3 -- nssqlite3
#
ns_section  "ns/server/${servername}/modules"
ns_param    nsdb            nsdb.so

ns_section  "ns/server/${servername}/db"
ns_param    defaultpool     sqlite3
ns_param    pools           *

ns_section  "ns/db/drivers"
ns_param    sqlite3         nssqlite3.so

ns_section  "ns/db/pools"
ns_param    sqlite3         "sqlite3"

ns_section  "ns/db/pool/sqlite3"
ns_param    driver          sqlite3
ns_param    connections     1
ns_param    datasource      /tmp/sqlite3.db
ns_param    verbose         off

I've created a nssqlite3 wiki page for the driver, which currently just contains a link to the initial nssqlite3 documentation. As more issues and questions arise, I'll update the wiki page and the documentation.

Posted by dossy at 03:51 PM | 104 | Link | Comments (6) | Trackbacks (0) | Bloglines | Feedster | Technorati | BlogPulse
468x60 Cyberguys brand banner v1


Comments
1
Gravatar Icon

Are you using nssqlite3? I try to use it, but aolserver 4.0.10 in my debian etch box is dead...

Posted by: Alexey Pechnikov on February 23, 2008 at 05:10 AM | Permalink
2
Gravatar Icon

# tail -f /var/log/aolserver4/offline.sid.mobigroup.ru.log
"db_foreach "select value from session" {
alloc: invalid block: 0xb4cf5378: 78 b4 20

Posted by: Alexey Pechnikov on February 23, 2008 at 06:44 AM | Permalink
3
Gravatar Icon

Alexey: Yes, I'm using nssqlite3 and it seems to work for me.

db_foreach, hm? Can you do a test using AOLserver's lower-level ns_db API and see if you can get queries to execute? Also, can you get a gdb backtrace of the crash?

Posted by: Dossy on February 23, 2008 at 10:23 AM | Permalink
4
Gravatar Icon

I use now libsqlite-tcl in AOL. It work better (I like sqlite-tcl interface with type control, variable bindings and many things). But I must load package sqlite3 in all threads. May be is better use nsproxy for this? I want to read in many threads parallel and write in one thread. With database lock wrapper (get db lock or sleep some times if db is locked already) it's work good.

I think, ns_db is very complex and universal but for better performance and code readable is not best idea. Sqlite transaction is performed about by 500 microseconds and complex wrappers make big overhead. And high concurent applications must use parallel readings. On my laptop sqlite database can perform about 1000 write transactions per second and so if my application in the ratio between 1:10 and 1:100 write to read transactions and one client send query every 5 seconds then sqlite-driven application can serve about between 50 000 and 500 000 clients at same times (with enable full sync write for sqlite database file).

Posted by: Alexey Pechnikov on March 19, 2008 at 07:47 AM | Permalink
5
Gravatar Icon

Alexey: You could definitely load sqlite-tcl in an nsproxy pool. The overhead of doing IPC to nsproxy should be minimal.

Posted by: Dossy on March 19, 2008 at 08:18 AM | Permalink
6
Gravatar Icon

Are you interested in an nssqlite patch to make empty return sets work? I suggested it, with an underwhelming response last month..

Posted by: Jeff on March 21, 2008 at 03:56 PM | Permalink
Post a comment

Who are you?

(what is this?)
(what is this?)
(what is this?)
(what is this?)


(required)
(required, not displayed)


Allowed markup: a href title, abbr title, acronym title, b, blockquote cite type, br, code, dd, dl, dt, em, i, li, ol, p, pre, strike, strong, tt, ul.

Please type in the letters shown in the image below:
Graphical CAPTCHA.

A preview of your comment:

Posted by: