RISC-V public beta platform released · Evaluation of database adaptation on RISC-V server

Preface

The last issue talked about YCSB's performance test of MySQL on the RISC-V server ( RISC-V public beta platform released·Using YCSB to test the performance of MySQL on SG2042 ). In this article, we continue to discuss the RISC-V+ database in depth Applications. In this issue, we will continue to use the HS-2 platform to test the compatibility of database software on the RISC-V server.

The databases participating in this experiment are as follows:

Redis

MongoDB5

PostgreSQL

TiDB

MySQL/MariaDB

The experimental machine configuration is as follows:

Processor: SG2042 (64 cores)

Memory: 32GB

Operating system: Ubuntu 22.10 (GNU/Linux 6.1.31 riscv64)

一、MySQL/MariaDB

In the previous issue, in order to test the YCSB (Yahoo! Cloud Serving Benchmark) performance testing software, the compatibility of MySQL on the RISC-V server was tested.

MySQL Database Service is a fully managed database service for deploying cloud-native applications using the world's most popular open source database. It is 100% developed, managed and supported by MySQL.

Install MySQL directly using the package manager:

sudo apt-get install mysql-server

Of course, in addition to the package manager installation, I also tried to compile and install MySQL, but the result was that the compilation failed. Therefore, MySQL cannot be installed directly through compilation. Instead, relevant patches need to be applied before compilation, and then compiled again.

At the same time, the compatibility of MariaDB, a general open source relational database management system, on the RISC-V server was also tested. It is one of the most popular database servers in the world, MariaDB is released under the GPLv2 open source license and is guaranteed to remain open source.

First try installing directly through the package manager:

sudo apt-get install mariadb-server

After installing and running normally through the package manager, try to install MariaDB by compiling.

First download the MariaDB source code package and unzip it:

wget

https://dlm.mariadb.com/3239838/MariaDB/mariadb-11.0.2/source/mariadb-11.0.2.tar.gz

Enter the MariaDB source code folder:

tar -xzvf mariadb-11.0.2.tar.gz 

Execute cmake and compile:

cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mariadb -DMYSQL_DATADIR=/home/mariadb 
-DSYSCONFDIR=/etc -DWITHOUT_TOKUDB=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 
-DWITH_ARCHIVE_STPRAGE_ENGINE=1 -DWITH_BLACKHOLE_STORAGE_ENGINE=1 
-DWIYH_READLINE=1 -DWIYH_SSL=system -DVITH_ZLIB=system -DWITH_LOBWRAP=0 
-DMYSQL_UNIX_ADDR=/tmp/mysql.sock -DDEFAULT_CHARSET=utf8 
-DDEFAULT_COLLATION=utf8_general_ci
make -j64
sudo make install -j1

 

Open the configuration file and edit:

vim /home/mariadb/my.cnf

picture

Start the server and test whether you can connect to the database server:

sudo /usr/local/mariadb/bin/mysqld_safe --user=mysql --skip-grant-tables
/usr/local/mariadb/bin/mariadb

picture

 connection succeeded!

2. Redis

Next is Redis. The full name of Redis is REmote DIctionary Server (Redis), written by Salvatore Sanfilippo. It is an open source, written in ANSI C language, complies with the BSD protocol, supports network, can be memory-based, distributed, optional persistence key-value pair (Key-Value) storage database, and provides APIs in multiple languages.

Redis is often called a data structure server because values ​​can be of types such as String, Hash, list, sets, and sorted sets.

Install Redis via APT:

sudo apt install redis-server

Then start the Redis service:

sudo servcie redis-server start

Enter redis-cli:

redis-cli

If you can enter the Redis Shell, the installation is successful.

Compile and install:

wget 

https://github.com/redis/redis/archive/refs/tags/7.0.12.tar.gz

Unzip:

tar -xzvf 7.0.12.tar.gz 

Enter the Redis folder:

cd redis-7.0.12/

Compile:

make BUILD_TLS=yes USE_SYSTEMD=yes -j64

Test it out (optional):

make test

Install:

sudo make install

Start the server:

redis-server
redis-server &(后台运行)
运行redis-benchmark压力测试(10万次请求,20个客户端),以CSV文件形式输出。
redis-benchmark -n 100000 -c 20 --csv

 The result is as follows:

picture

 Therefore, Redis can be installed through APT installation or compilation installation.

3. MongoDB

Next is MongoDB, which is a database based on distributed file storage. Written in C++ language. Designed to provide scalable, high-performance data storage solutions for WEB applications. MongoDB is a product between a relational database and a non-relational database. It is the most feature-rich among non-relational databases and is most similar to a relational database.

Install MongoDB via APT:

sudo apt install mongodb

The result indicates that installation through apt is not supported, so we choose to compile and install from source code.

Download the source code package:

wget 

https://fastdl.mongodb.org/src/mongodb-src-r6.0.8.tar.gz

unzip:

tar -xzvf mongodb-src-r6.0.8.tar.gz

Enter the mongodb source code folder:

cd mongodb-src-r6.0.8/

Compile:

python3 buildscripts/scons.py install-mongod -j64

As a result, compilation failed:

picture

After installing the relevant packages, it still cannot be compiled.

4. PostgreSQL

Then there's PostgreSQL, which is a free object-relational database server (ORDBMS) released under the flexible BSD license. PostgreSQL developers pronounce it post-gress-QL. PostgreSQL's Slogan is "the world's most advanced open source relational database."

Install via APT:

apt-get install postgresql postgresql-client

have a test:

sudo -i -u postgres
psql

picture

 Compile and install:

Download source code:

wget 

https://ftp.postgresql.org/pub/source/v15.3/postgresql-15.3.tar.gz

Unzip:

tar -xzvf postgresql-15.3.tar.gz

Create a new pg folder:

mkdir pg

Enter:

cd postgresql-15.3/

Configuration:

./configure --prefix=/home/perfxlab01/pg

Compile and install:

make world -j64
make install-world -j64
进入~/pg/

 Initialize the database:

./bin/initdb -D ./data/

Start the database:

bin/pg_ctl -D ./data/ -l logfile start

After successfully starting the database, the next step is to test the database performance. PostgreSQL, like Redis, also comes with a stress test program.

Create a new database for stress testing:

bin/psql -U postgres -h localhost
(进入psql shell)
CREATE DATABASE test;
(退出psql shell)

Initialize the database for stress testing:

bin/pgbench -i test

Start the stress test:

bin/pgbench -c 100 -T 300 -j 64 test

The stress test results are as follows:

pgbench (15.3)
transaction type: <builtin: TPC-B (sort of)>
scaling factor: 1
query mode: simple
number of clients: 100
number of threads: 64
maximum number of tries: 1
duration: 300 s
number of transactions actually processed: 93122
number of failed transactions: 0 (0.000%)
latency average = 322.405 ms
initial connection time = 156.199 ms
tps = 310.168586 (without initial connection time)
statement latencies in milliseconds and failures:
0.005           0  \set aid random(1, 100000 * :scale)
0.002           0  \set bid random(1, 1 * :scale)
0.002           0  \set tid random(1, 10 * :scale)
0.002           0  \set delta random(-5000, 5000)
0.201           0  BEGIN;
1.144           0  UPDATE pgbench_accounts SET abalance = abalance + :delta WHERE aid = :aid;
0.429           0  SELECT abalance FROM pgbench_accounts WHERE aid = :aid;
290.788           0  UPDATE pgbench_tellers SET tbalance = tbalance + :delta WHERE tid = :tid;
26.624           0  UPDATE pgbench_branches SET bbalance = bbalance + :delta WHERE bid = :bid;
0.432           0  INSERT INTO pgbench_history (tid, bid, aid, delta, mtime) VALUES (:tid, :bid, :aid, :delta, CURRENT_TIMESTAMP);
2.556           0  END;

5. TiDB

Next is TiDB. TiDB is an open source distributed relational database independently designed and developed by PingCAP. The database is written in Go language.

Download the latest version of the TiDB source code package, unzip it and enter the source code folder, then compile:

tar -xzvf tidb-7.1.1.tar.gz
cd tidb-7.1.1/
make

As a result, compilation failed:

picture

At the same time, I also tried to install it through a script, but the result was that the architecture is not supported.

Summarize:

Through this experiment, the following results were obtained.

database

APT installation/script installation

Compile and install

Redis

MongoDB

×

×

PostgreSQL

TiDB

×

×

MySQL

×

MariaDB

1. In the last issue, I mentioned that MySQL does not support direct installation through compilation. It can only be compiled by applying the patch provided by Ubuntu (see MySQL server fails to build on RISC-V 64 for details), while MariaDB can be installed through compilation or package management. There are two ways to install the device. However, after compilation and installation, further manual configuration is required (see reference materials for tutorials), while the installation system through the package manager will automatically configure it for you and use it out of the box. Therefore, it is recommended to install MySQL/MariaDB through APT (package manager). More time-saving and convenient.

2. Among the four database software currently tested, MongoDB only has a software package suitable for Ubuntu 22.04 LTS, while TiDB does not support riscv64 in either script installation or compiled installation. Therefore, we hope that the support of these two databases on the RISC-V architecture will be strengthened.

3. The most outstanding performers in this compatibility test are PostgreSQL and Redis. Both of them compiled smoothly and can run normally. It shows that the compatibility of these two databases with riscv64 is very good. Especially for PostgreSQL, some community members in the PostgreSQL BuildFarm have successfully compiled using the compiler on the riscv64 platform. Therefore, it is inevitable that PostgreSQL can be successfully compiled and run on the riscv64 platform.

4. Both Redis and PostgreSQL come with their own stress testing tools. Redis’s redis-benchmark sets the stress test parameters, and then just wait for the test results to be released. Compared with redis-benchmark, PostgreSQL’s pgbench only needs to set the stress test parameters. Just add the two steps of creating a test database and initializing the test database. Therefore, the built-in stress test program is a plus for these two databases, because using the built-in stress test program can help users understand the performance of the server in terms of databases.

References:

Introduction to MariaDB

https://mariadb.org/zh/

Redis Tutorial

https://www.runoob.com/redis/redis-tutorial.html

MongoDB official website

https://www.mongodb.com/zh-cn

MongoDB developer community

https://www.mongodb.com/community/forums/t/when-to-upload-version-on-debian/181125

mongodb-server binary package in Ubuntu Focal riscv64

https://launchpad.net/ubuntu/focal/riscv64/mongodb-server

MySQL server fails to build on RISC-V 64

https://bugs.mysql.com/bug.php?id=100356

Deploy Mariadb database to Linux (source code compilation and installation)

https://www.cnblogs.com/DragonStart/p/10823222.html

PostgreSQL BuildFarm Status

https://buildfarm.postgresql.org/cgi-bin/show_status.pl

PostgreSQL BuildFarm Status History

https://buildfarm.postgresql.org/cgi-bin/show_history.pl?nm=boomslang&br=REL_15_STABLE

TiDB

https://docs.pingcap.com/zh/tidb/stable

End of text


  • About HS-2

The HS-2 RISC-V universal motherboard is a standard mATX motherboard designed for developers jointly developed by Pengfeng Technology and its partners. It is pre-installed with a software package customized and developed by Pengfeng Technology for RISC-V high-performance servers. Including various standard benchmarks, GCC compilers supporting V extensions, computing libraries, middleware, and a variety of typical server applications.

The HS-2 RISC-V general-purpose motherboard is equipped with a domestic RISC-V 64-core processor (SG2042). SG2042 is the highest-performance RISC-V processor currently in mass production. It is mainly designed for the needs of high-performance computing and is suitable for large computing power application scenarios such as scientific computing, engineering computing, AI computing, and fusion computing.

picture

  • About the RISC-V public test platform

    picture

RISC-V high-performance processor public test cloud platform · quick use guide, download link: https://www.kdocs.cn/l/cmnYcyFIlVRx

  • RISC-V public test cloud platform series of articles

  1.  RISC-V Public Test Platform Released Stream Bandwidth Complete Test

  2.  RISC-V public beta platform released · Minecraft MohistMC

  3.  RISC-V public beta platform released·The first WEB Server "Hello RISC-V world!"

  4.  RISC-V public beta platform released·How to play k3s on SG2042

  5. "RISC-V Growth Diary" blog released, the first blog running on RISC-V server?

  6. RISC-V public beta platform released: How to play OpenMPI on SG2042

  7. RISC-V public beta platform released: Compiling The Fedora Linux Kernel Natively on RISC-V

  8.  RISC-V public beta platform released·Unix Bench complete test

  9. RISC-V public beta platform released·Using YCSB to test MySQL performance on SG2042

  10. RISC-V public beta platform released · 7-zip test

  11. RISC-V public beta platform released · CoreMark test report

  12. RISC-V public beta platform released · Adaptation evaluation of database on RISC-V server (this article)

Welcome to submit articles and send them to [email protected]

Guess you like

Origin blog.csdn.net/weixin_45571628/article/details/132412110