2

What is the most used database server for web browsers such as Chrome, Firefox, Opera, or Safari? Maybe I don't understand web browsers, but I am assuming they must have a database server the same way a web application has a database server.

5

I am assuming they must have a database server the same way a web application has a database server.

What is the basis for that assumption? Web browsers and web applications are different things and they do different things; therefore they do not automatically share requirements.

You guessed right that browsers can and often do use databases – but they don't do so "because web applications use a database". If/when they use a database, they have a specific need for it: long-term, searchable, data storage. That's it.


For many web applications, the needs for a database are obvious: if they have user accounts, they need to store those accounts somewhere; if they have user-editable pages, they need to store the page contents somewhere; and so on. Must a web application have a database? Only if it needs to store data.

Compared to that, what would a web browser store? Generally it doesn't run the webapp – it only renders the HTML pages that a webapp sends. Most internals of a webapp, including whether it uses a database or not, are completely hidden from the browser.

Instead, the primary uses of a database in web browsers are for implementing the browser's own functionality: to store the browsing history, or your bookmarks, or cookies. (And, yes, these days a webpage could ask the browser to store some things via JavaScript (IndexedDB) – but that's not the primary storage of most webapps.)


So what does a web browser, or indeed any other desktop application, use? Well, it doesn't use a database server – it uses an embedded database.

Databases do not require a dedicated "server" program. Database servers exist to implement multi-user features (authentication, privilege checking, replication). But if the database is completely owned by you and reasonably small in size (for example, just your web bookmarks), then it doesn't need those features and the actual storage can be implemented using a simple local library.

If you need full SQL, probably the most popular "single-file" database is SQLite. Both Firefox and Chrome use SQLite to store bookmarks; history; certificates; preferences; and so on.

As for simple non-SQL "key/value" databases, Berkeley DB used to be the popular choice – although due to licensing issues and somewhat outdated design you often see it being replaced by LMDB and LevelDB (or indeed by the same SQLite).

For example: when web pages use the JavaScript IndexedDB API, Chrome stores the data in a LevelDB database; Internet Explorer uses Windows ESENT; and Firefox uses SQLite.

(There are plenty other embedded database types – the Wikipedia article I linked to earlier has a long list – but they're nowhere near as popular. Even Windows itself, which comes with the ESENT database engine built in, can be caught using SQLite at times.)

Finally, many kinds of data are small enough that they doesn't need a full database engine at all and could be directly put into files. Many browsers actually store cookies in textual "cookie jar" files – one cookie per line, one file per domain. Mozilla/Netscape used to store bookmarks in the form of a single almost-HTML webpage. The modern choice is generally to format the data using JSON before storing it.


As I noted, this is nothing specific to web browsers. They just use a database because they have data to store – but the same can be said about mail clients, music players, games, and so on, all of which frequently have some sort of an embedded database to keep things in.

(Don't forget that the Windows Registry, where most programs keep their settings, is also a key/value database, as is the filesystem itself.)

Not the answer you're looking for? Browse other questions tagged or ask your own question.