Wiki source code of mysqld spikes CPU when starting iSymphony V3
Version 19.1 by michaely on 2014/04/03 14:10
Show last authors
author | version | line-number | content |
---|---|---|---|
1 | ====== On this page ====== | ||
2 | |||
3 | |||
4 | |||
5 | {{toc maxLevel="5"/}} | ||
6 | |||
7 | == Symptoms == | ||
8 | |||
9 | When starting the iSymphony V3 server you see that the process mysqld spikes in CPU usage for long periods of time. | ||
10 | |||
11 | == Cause == | ||
12 | |||
13 | iSymphony relies on CDR (Call Detail Record) entries to query information about about call recordings in your system due to the fact that not all metadata about a recording can be placed in the recording file name to parse out. If you have a very large amount of CDR entries in your CDR database these queries can take a very long time and one query needs to be made for each recording in your system. | ||
14 | |||
15 | == Resolution == | ||
16 | |||
17 | |||
18 | |||
19 | In order to speed up these queries you will need to index the uniqueid column in the Asterisk CDR database table. The steps to index the uniqueid column will vary based on the Asterisk configuration. | ||
20 | |||
21 | |||
22 | |||
23 | Below is an example on how do index the unique id column in a FreePBX based system utilizing a mysql database: | ||
24 | |||
25 | 1. ((( | ||
26 | Run the following command to get the database username and password. They will be labeled "AMPDBUSER" and "AMPDBPASS". | ||
27 | |||
28 | {{code language="bash"}} | ||
29 | cat /etc/freepbx.conf | ||
30 | {{/code}} | ||
31 | ))) | ||
32 | 1. ((( | ||
33 | Next run the following command to log into the mysql database: | ||
34 | |||
35 | {{code language="bash"}} | ||
36 | mysql -u <database username> -p | ||
37 | {{/code}} | ||
38 | ))) | ||
39 | 1. Enter the database password when prompted. | ||
40 | 1. ((( | ||
41 | Once you are in the mysql command line run the following command to switch to the CDR database: | ||
42 | |||
43 | {{code}} | ||
44 | use asteriskcdrdb; | ||
45 | {{/code}} | ||
46 | ))) | ||
47 | 1. ((( | ||
48 | Run the following command to create the index: | ||
49 | |||
50 | {{code language="sql"}} | ||
51 | ALTER TABLE `cdr` ADD INDEX `uniqueid` (`uniqueid`); | ||
52 | {{/code}} | ||
53 | ))) | ||
54 | 1. ((( | ||
55 | Run the following command to verify the index was created: | ||
56 | |||
57 | {{code language="sql"}} | ||
58 | SHOW INDEX FROM cdr; | ||
59 | {{/code}} | ||
60 | ))) | ||
61 | 1. ((( | ||
62 | Type the following command to exit the mysql command line: | ||
63 | |||
64 | {{code}} | ||
65 | \quit | ||
66 | {{/code}} | ||
67 | ))) | ||
68 | |||
69 | == Related Content == | ||
70 | |||
71 | {{expand title="Expand to see related content"}} | ||
72 | {{unmigrated-inline-wiki-markup atlassian-macro-output-type="BLOCK"}} | ||
73 | {dynamiccontentbylabel:showLabels=false|showSpace=false} | ||
74 | {{/unmigrated-inline-wiki-markup}} | ||
75 | {{/expand}} |