Difference between revisions of "Adjusting DbStat"

Line 1: Line 1:
Why would anyone turn off MySQL statistic?
{{Archive}}Why would anyone turn off MySQL statistic?
Author - [http://wiki.zimbra.com/wiki/User:Singkoo Sing Koo]
Author - [http://wiki.zimbra.com/wiki/User:Singkoo Sing Koo]

Latest revision as of 18:29, 24 March 2015

Why would anyone turn off MySQL statistic?

Author - Sing Koo

I can hardly find a good reason for it if you are running Zimbra as an IT component in any enterprise business environment. This is like throwing away your oil dip stick in your car. Even if you would never check the engine oil level, you will not find a reason to justify doing that. But what if you are building a model plane that runs on solar energy, any relief from reducing the weight would help. In that situation, you may want to run a theoretical minimum environment to see how much more you can gain by tweaking the components. This is a note for this kind of special situation, where you want to examine this possibility. This is what I would label as "an impromptu with the inner work Zimbra" or "toying around with ideas" in hope to find a better way of doing the same thing. Through the process, we can learn the inner work of Zimbra.

1. Obtain the source code of your binary distribution using Perforce (refer to Zimbra Wiki using Perforce)


2. Installation Eclipse in your operating system if you have not done so

3. Setup ZimbraServer project and have your project directory at, something similar to the following path:


4. Search and open com.zimbra.cs.db.DbStats.java inside the ZimbraServer project

5. Locate the following code fragment within the source code of DbStats.java:

            data.put(ZimbraPerf.RTS_DB_POOL_SIZE, DbPool.getSize());
           // Parse innodb status output
           DbResults results = DbUtil.executeQuery("SHOW INNODB STATUS");
           BufferedReader r = new BufferedReader(new StringReader(results.getString(1)));
           String line = null;
           while ((line = r.readLine()) != null) {
               Matcher m = PATTERN_BP_HIT_RATE.matcher(line);
               if (m.find()) {
                   data.put(ZimbraPerf.RTS_INNODB_BP_HIT_RATE, m.group(1));

You can then evaluate this code segment and determine what to do with it. Of course, the DB statistic is there because it is a valuable piece of information for system turning. On the other hand, you may be interested to find out what happens if you disable it. If you make changes to the code, then follow the rest of the steps to compile and deploy the code.

6. Save the source file

7. Right mouse click on build.xml within ZimbraServer and select to run Ant Build to compile the changes

8. Copy the zimbrastore.jar and zimbarcommon.jar to the Zimbra's Jetty directory -> /opt/zimbra/jetty/webapps/zimbra/WEB-INF/lib

9. Restart Jetty -> zmcontrol restart

Jump to: navigation, search