Project

General

Profile

Slow database access using mysql-ruby

Added by Martin Norbury about 15 years ago

Hi,

I have recently started using redmine as our software issue tracker at the company I work for. Initially we were running redmine without the MySQL C bindings but over several days we experienced regular lock-ups which required the redmine server to be restarted. After browsing the newsgroups it became apparent that installing the MySQL C binding could help with this problem. However, although the C binding were supposed to "dramatically improve performance" we noticed a drastic increase in the loading time of most pages in redmine. In particular prior to installing the C binding the production.log showed typical access times of:-

Completed in 0.23486 (4 reqs/sec) | Rendering: 0.17612 (74%) | DB: 0.02955 (12%) | 200 OK [http://ticketsba/projects/telops/issues]

after installing the C binding (using gen install mysql) the access times became:-

Completed in 3.31768 (0 reqs/sec) | Rendering: 0.17220 (5%) | DB: 3.10404 (93%) | 200 OK [http://ticketsba/projects/telops/issues]

Currently our ticket database is pretty small i.e. < 50 issues, so I wouldn't expect to see any DB issues at this stage.

If I uninstall the mysql-ruby component (gem uninstall mysql) and restart redmine, the DB access times go back to a few milliseconds (occasionally 10's of milliseconds in the worst case).

So, the crux of my problem is I'm puzzled as to why the MySQL C connectors are apparently degrading performance when they are supposed to increase it. Does anyone else see this also and what are people typical DB access times?

Many thanks,
Martin

Details:-

I'm using Centos and redmine version 0.8.2 (downloaded as a tarball as opposed to SVN checkout). We are using MySQL 5.1.30 and Mongrel 1.1.5.

I'm actually using the production environment for the deployed version but for some reason the scripts/about didn't work with the production environment, so the following is the exact same settings pasted to the development environment section.

About your application's environment
Ruby version 1.8.7 (i686-linux)
RubyGems version 1.3.1
Rails version 2.1.2
Active Record version 2.1.2
Action Pack version 2.1.2
Active Resource version 2.1.2
Action Mailer version 2.1.2
Active Support version 2.1.2
Edge Rails revision unknown
Application root /usr/local/share/redmine
Environment development
Database adapter mysql
Database schema version 101