Knowledge Base

How Can We Help?

Installation and Details of MySQL Pinba storage engine

You are here:

Pinba is a storage engine for MySQL that acts as a real-time monitoring server for PHP, using MySQL as a read-only interface. The Pinba extension is utilized to measure specific sections of code using timers with arbitrary tags. It also accumulates and processes data sent over UDP by multiple PHP processes. Pinba displays statistics in a user-friendly format and provides a read-only interface to the raw data for generating more advanced reports and stats. Technical metrics for each PHP thread are collected by Pinba, which then sends these metrics to a central Pinba server over UDP once the response generation is complete. The Pinba engine aggregates the contents of these messages on the central server and bulk inserts them periodically into a read-only MySQL database, providing a simple and familiar exploration tool, a MySQL client. Pinba’s main purpose is not debugging, but rather helping developers monitor the performance of PHP scripts by identifying bottlenecks in real-time and directing attention to the sections of code that require improvement.

Pinba accumulates data in a set of read-only MySQL tables, consisting of two types:

1) Raw data tables: These tables are used to generate custom reports. Accessing raw data is relatively slow if there are a large number of records with no index except for primary keys.

2) Reports: These are already aggregated data that updates on-the-fly as new request data arrives.

The Pinba working stack comprises two parts: the Pinba engine and the PHP extension. The Pinba Engine acts as a pluggable storage engine for MySQL or MariaDB, while clients such as the PHP Pinba Extension and the Nginx Pinba Module feed data into it. The engine itself provides access to reports and raw data. There is a GUI available called “Pinboard”.

Advantages

1) Powerful
2) Provides live metrics in production with no impact on performance
3) Helps detect bottlenecks
4) Used to find bugs (e.g., excessive backend usage in certain routes)
5) Enables the creation of graphs and integration with alerting systems to detect regressions after a release.

 

Installing Pinba Server on CentOS

1) Download the package

   # wget http://pinba.org/files/pinba_engine-1.1.0.tar.gz

2) Extract the files

   # tar xzvf pinba_engine-1.1.0.tar.gz

3) Change to the directory

    # cd pinba_engine-1.1.0

4) Install the required dependencies

   # yum install Judy.x86_64 protobuf.x86_64 libevent.x86_64 Judy-devel.x86_64 protobuf-devel.x86_64 libevent-devel.x86_64

5) Download the source code of the corresponding MySQL version from the official site (to check the version, use “mysql -V”)

   # wget http://downloads.mysql.com/archives/get/file/mysql-5.5.44.tar.gz

# tar xzvf mysql-5.5.44.tar.gz

# cd mysql-5.5.44

6) Install pinba_engine and return to the pinba-engine source folder

   # ./configure –with-mysql =. / mysql-5.5.44 –with-judy = / usr –with-protobuf = / usr –libdir = / usr / lib64 / mysql / plugin /

7) Use the make commands

  # make

# make install

9) Create a database

   mysql -u root -p

mysql> INSTALL PLUGIN pinba SONAME ‘libpinba_engine.so’;

mysql> CREATE DATABASE pinba;

mysql> exit;

mysql -D pinba <default_tables.sql

10) Add pinba-server to /etc/my.cnf

   pinba_port = 3300

pinba_stats_gathering_period = 10000

pinba_stats_history = 900

pinba_temp_pool_size = 10000

pinba_request_pool_size = 1000000

11) Restart mysqld

   # service mysqld restart

If you require further assistance, please contact our support department.

Leave a Comment