DBJoules: An Energy Measurement Tool for Database Management Systems


Tool Description

DBJoules, a tool designed to measure the energy consumption of database queries across four databases, i.e., MySQL, PostgreSQL, MongoDB, and Couchbase. This tool measures the energy consumption of queries by gathering the information about CPU and RAM usage, by utilizing psutil package.

Installation

Requirements

From Github

STEP1: Clone or download this github repository:

git clone https://github.com/rishalab/DBJoules.git


STEP2: Navigate to the directory

cd DBJoules

STEP3: Run "setup.py" file to install necessary dependencies

python setup.py

STEP4: Run "stop_background_processes.py" file to stop all the currently running background processes.

python stop_background_processes.py

STEP5: Start the tool

python main_app.py


Usage

Comparing energy consumption of query execution among MySQL, PostgreSQL, MongoDB and Couchbase databases.

Approach diagram

DBJoules uses psutil package to measure energy consumption. The tool is developed to compare energy consumed by CPU and RAM for query execuation. The internal workflow is described in the below figure.

elegant icons

Packages used in DBJoules

  • mysql-connector-python: This module facilitates Python programs in accessing and manipulating MySQL databases through API calls.
  • psycopg2: Psycopg is the most popular PostgreSQL database adapter for the Python. It offers complete implementation of the Python DB API 2.0 specification10 and ensures thread safety.
  • pymongo: This package serves as a native Python driver for MongoDB, providing tools for seamless interaction with MongoDB databases from Python.
  • couchbase: This module allows Python applications to access a Couchbase cluster efficiently.
  • psutil.cpu_percent(): This function gathers CPU utilization percentage for calculating energy consumed by CPU.
  • psutil.virtual_memory(): This function provides the allocated memory for calculating energy consumed by RAM.

Goal

Helping developers and practitioners to choose energy efficient database.

Results

The evaluation experiments have been done on 2 systems of different configurations considering 2 different datasets.
  • Netflix Userbase dataset
  • SMS Spam dataset
  • Following are the results for executing select query in all 4 databases using Netflix Userbase dataset

    elegant icons

    Demo Video

    Note

    • The document in MongoDB query should be in JSON format
    • Internet should be connected while running the tool

    Contributors

    Hemasri Sai Lella, Kurra Manasa, Rajrupa chattaraj, Sridhar Chimalakonda