Configuration for multithreaded clients

Alles, was MariaDB und MySQL betrifft, kann hier besprochen werden.

Configuration for multithreaded clients

Postby ThisIsNotMyName » 23. September 2019 16:10

I have a Linux C application that makes use of the services of a MariaDB 10.0.34 server, also running under Linux. The application launches individual threads to do operations against the MariaDB server. My setup is the following:

1. Using the MariaDB C API, each thread opens a separate connection to the server, carries out its operations, and then closes the connection when done.
2. Each thread operates on the same database and on the same table.
3. There are no thread locks in the code run by the threads - the MariaDB server is assumed to manage the simultaneous connections.
4. The probability for each thread to be operating on the same element in table at the same time is negligible.
5. The application and the MariaDB server run in the same system.
6. The system where this is all running is a multicore one.

The problem that I am facing is that the performance of this setup is very poor. The application (which is driven by external events the nature of which is not relevant to this discussion) launches its threads to interact with the MariaDB server. These threads seem to be running sequentially, rather than taking advantage of the many cores available in the system. In essence, the threads keep accumulating, because they seem to be created faster than they can complete. While each thread, while running on its own, should terminate in a matter of a few seconds, once they start accumulating each may make take many minutes to complete - they seem to be competing with each other for the MariaDB server's resources: there doesn't seem to be any parallelism involved, despite the fact that the system has plenty of resources for the job.

I would like to make sure that my MariaDB server is configured adequately for the scenario I described above - which it is probably not, for I am a newbie to MariaDB. my /etc/my.cnf file includes all the files under /etc/my.cnf.d. One of them is named server.cnf, and it includes the following lines:


That's pretty much it, as far as my MariaDB server configuration is concerned.

What I am asking for is feedback concerning how to configure my MariaDB server to address my scenario. The system is by no means stressed - when running, with tens of threads executing simultaneously, the system load never reaches 2.0, and most of the 16 cores available are idle most of the time.
Posts: 3
Joined: 16. September 2019 21:31
XAMPP version: 1
Operating System: LInux

Re: Configuration for multithreaded clients

Postby Nobbie » 23. September 2019 20:06

You probably overestimate this forum and its scope. This forum is NOT for C-applications under Linux, it is a forum for Xampp (a webserver distribution) under Linux with the components Apache, MySQL (MariaDB), PHP, Perl.

In particular it is the task of this forum to help Xampp users with the Xampp installation under Linux. This forum is NOT a specialist forum for general Apache and Linux issues and it is NOT a forum for performance issues. This forum is only about the problems that can occur in combination with a Xampp installation under Linux. Unfortunately, your requests are light years away from this task. I'm sorry, but no one can help you here.

And finally: actually this is a german forum. There are English subforums here, but especially here we are definitely in the German area, as you should recognize by the title: " Grundlagen und Wissenswertes ".

My advice would be, look for you a forum with the suitable knowledge range.
Posts: 11918
Joined: 09. March 2008 13:04

Return to MariaDB - MySQL

Who is online

Users browsing this forum: No registered users and 4 guests