This project is a web application for an academic benchmark of different database paradigms. It compares relational, document-oriented, NewSQL, and in-memory databases through equivalent operations and controlled synthetic data.
The goal is not to produce a universal database ranking. The application is designed to support an undergraduate thesis by showing how different storage models behave under the same local benchmark conditions.
- PostgreSQL: traditional relational SQL database.
- MongoDB: document-oriented NoSQL database.
- CockroachDB single-node: NewSQL database running as one local node.
- CockroachDB cluster: NewSQL database running as a local three-node cluster.
- Redis: in-memory key-value database.
/: introductory academic home page./sobre: detailed methodology page covering data preparation, operations, metrics, database behavior, and limitations./benchmark: benchmark execution page./api/benchmark: API route that runs the selected benchmark configuration./api/health: basic health endpoint.
The application is built with Next.js App Router. The frontend renders the academic pages, benchmark form, result table, and charts. The backend benchmark execution runs inside a Next.js API route.
The benchmark flow is:
- The user selects databases, operations, volume, and number of rounds in
/benchmark. - The frontend sends the configuration to
/api/benchmark. - The benchmark runner prepares the required data for each selected database.
- Each selected operation is executed for the configured number of rounds.
- Metrics are calculated for the current execution.
- The frontend displays results in a sortable table and comparison charts.
The database containers are managed by Docker Compose. The application connects to them through localhost ports exposed by docker-compose.yml.
The benchmark supports three operations:
INSERT: inserts generated application log records.SELECT by ID: fetches one log record by unique identifier.Relational SELECT: fetches related user and order data.
The relational operation is implemented according to each database model:
- PostgreSQL and CockroachDB use SQL tables and
JOIN. - MongoDB uses collections and aggregation with
$lookup. - Redis uses hashes and sets to model related access by keys.
For each database and operation, the application reports:
- Average execution time.
- Best execution time.
- Worst execution time.
- Estimated TPS, based on the configured volume and measured average time.
Results are calculated only for the current benchmark execution. They are not persisted as historical benchmark data.
- Next.js 14 with App Router.
- React 18.
- TypeScript.
- Tailwind CSS.
- shadcn-style UI primitives.
- TanStack Table for sortable result tables.
- Recharts for result charts.
- PostgreSQL driver:
pg. - MongoDB Node.js driver.
- Redis Node.js client.
- Docker Compose for local database orchestration.
- Node.js
20.19.0or newer. - npm.
- Docker.
- Docker Compose.
Running npm run db:up starts the following containers:
| Service | Container | Host Port |
|---|---|---|
| PostgreSQL | tcc_postgres |
5433 |
| MongoDB | tcc_mongo |
27017 |
| Redis | tcc_redis |
6379 |
| CockroachDB single-node SQL | tcc_cockroach_single |
26260 |
| CockroachDB single-node dashboard | tcc_cockroach_single |
8083 |
| CockroachDB cluster node 1 SQL | tcc_cockroach1 |
26257 |
| CockroachDB cluster node 1 dashboard | tcc_cockroach1 |
8080 |
| CockroachDB cluster node 2 SQL | tcc_cockroach2 |
26258 |
| CockroachDB cluster node 2 dashboard | tcc_cockroach2 |
8081 |
| CockroachDB cluster node 3 SQL | tcc_cockroach3 |
26259 |
| CockroachDB cluster node 3 dashboard | tcc_cockroach3 |
8082 |
The Docker Compose file also includes a cockroach-init service that initializes the three-node CockroachDB cluster.
Install dependencies:
npm installStart the database containers:
npm run db:upStart the development server:
npm run devOpen the application:
http://localhost:3000
Open the benchmark page directly:
http://localhost:3000/benchmark
- Start the database containers with
npm run db:up. - Start the application with
npm run dev. - Open
http://localhost:3000/benchmark. - Select the databases to compare.
- Select one or more operations.
- Choose the record volume and number of rounds.
- Run the benchmark.
- Review the table and charts generated for the current execution.
npm run devStarts the Next.js development server.
npm run buildCreates a production build.
npm run startStarts the production server after a successful build.
npm run db:upStarts all database containers with Docker Compose.
npm run db:downStops and removes the database containers.
Create a production build:
npm run buildStart the production server:
npm run start- The benchmark runs locally, so results depend on the host machine, Docker configuration, and available resources.
- The data is synthetic and controlled for academic comparison.
- Redis does not provide native joins; the relational operation uses hashes and sets as an equivalent key-based model.
- CockroachDB cluster results can include distributed coordination overhead even when all nodes run on the same machine.
- The benchmark is intended for controlled comparison in this project, not for general-purpose performance claims.
Stop and remove the database containers:
npm run db:down