fastcgipp-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Fastcgipp-users] database query vs file read


From: Axel von Bertoldi
Subject: Re: [Fastcgipp-users] database query vs file read
Date: Mon, 18 Jan 2010 08:43:56 -0700

Mike,

In general disk IO will always be slower than reading from memory. An SQLite query would only incur a memory read since (I assume) SQLIte would load the DB file into memory. A file read would incur disk IO the fist time the file was read. The file would then be cached in memory (by the OS) so subsequent reads of that file would not require IO (until you started to run out of memory and that file was cleared from the cache). I don't think you'd see much of a difference in this scenario.

Alternatively you might look at Nginx's caching capabilities.

axel.

On Mon, Jan 18, 2010 at 2:44 AM, <address@hidden> wrote:
This is a slightly off-topic general question. I am building a web app using
fastcgi++ (on Nginx+FastCGI) which at the moment builds a simple navigation menu
(10 to 20 items) on each page access by querying an Sqlite database (using a 3rd
party library).

I'm wondering if there would be any significant gains (or losses) in caching the
menu in a file and reading it in from disk rather than doing a database query
each request?

I guess the question is whether, generally speaking, C++ is quicker reading small
text files on disk vs querying a database?

Thanks for any ideas

Mike









reply via email to

[Prev in Thread] Current Thread [Next in Thread]