# High CPU Usage

**URL:** https://forum.mautic.org/t/high-cpu-usage/6171
**Category:** General Discussion
**Created:** [October 10, 2016, 1:49pm UTC](https://forum.mautic.org/t/high-cpu-usage/6171 "2016-10-10T13:49:04Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![pietromantovani](https://avatars.discourse-cdn.com/v4/letter/p/f07891/32.png) [@pietromantovani](https://forum.mautic.org/u/pietromantovani)
#### Post date: [October 10, 2016, 1:49pm UTC](https://forum.mautic.org/t/high-cpu-usage/6171/1 "2016-10-10T13:49:04Z")

</div>

Hi, I’m experiencing very High CPU Usage. I know I have a lots of leads, and I send 1000/2000 email/day. Does anybody have the same problem?

---

<div class="post-metadata">

### Author: ![pietromantovani](https://avatars.discourse-cdn.com/v4/letter/p/f07891/32.png) [@pietromantovani](https://forum.mautic.org/u/pietromantovani)
#### Post date: [October 10, 2016, 1:49pm UTC](https://forum.mautic.org/t/high-cpu-usage/6171/2 "2016-10-10T13:49:04Z")

</div>

Hi, I’m experiencing very High CPU Usage. I know I have a lots of leads, and I send 1000/2000 email/day. Does anybody have the same problem?

---

<div class="post-metadata">

### Author: ![jribeiro](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/jribeiro/32/1003_2.png) [@jribeiro](https://forum.mautic.org/u/jribeiro)
#### Post date: [June 2, 2022, 6:58am UTC](https://forum.mautic.org/t/high-cpu-usage/6171/3 "2022-06-02T06:58:41Z")

</div>

+1  
MySQL is having high usage for segments rebuild. This is happening since update to 4.3.1  
My host provider sent me a mail with a complain about CPU overhead

---

<div class="post-metadata">

### Author: ![mikew](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/mikew/32/5156_2.png) [@mikew](https://forum.mautic.org/u/mikew)
#### Post date: [June 2, 2022, 7:59am UTC](https://forum.mautic.org/t/high-cpu-usage/6171/4 "2022-06-02T07:59:14Z")

</div>

This all depends on the number of contacts, number of segments, number of campaigns and how your cronjob are setup to run.

It is a science in itself and would be amazing if Mautic was able to address this issue, currently it is a manual configuration thing and you need to understand how to setup this by yourself using cronjob.

It can also be on sites that have very high traffic.

---

<div class="post-metadata">

### Author: ![jribeiro](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/jribeiro/32/1003_2.png) [@jribeiro](https://forum.mautic.org/u/jribeiro)
#### Post date: [August 14, 2022, 6:26am UTC](https://forum.mautic.org/t/high-cpu-usage/6171/5 "2022-08-14T06:26:48Z")

</div>

It not depend of number of contacts or anything else. I have moved my mautic instance to a private server with Ubuntu 20.04 php 8.0.21 and mariadb 10.6.7  
Everything is fine but when selected option channel-\>emails… Even I am not doing nothing suddendly the mariadb process is starting to use more and more CPU until 100% and mautic is hung… I can not sleect other option… I just need to restart mariadb and then I can use again everything in mautic if I will not select emails option. cronjobs are stopped in otrder to do not have any task running… The result is always the same entering in the emails list (with only 17 mails) the CPU goes up because the DB usage. I have 2 Cores and 4GB (memory usage is ok)  
Mautic version is 4.4.1 (I think this happens since version 4  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/7/78a336b1d01436cf83843ead71ff9e0a6c11c14d.png)

---

<div class="post-metadata">

### Author: ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)
#### Post date: [August 14, 2022, 11:01am UTC](https://forum.mautic.org/t/high-cpu-usage/6171/6 "2022-08-14T11:01:42Z")

</div>

Hi,  
Is it possible, that your cron commands are overlapping each other?  
Is this dedicated CPU? Also: is it possible, that your mariadb settings are different from before and certain memory settings make the process less efficient?

---

<div class="post-metadata">

### Author: ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)
#### Post date: [August 14, 2022, 11:17am UTC](https://forum.mautic.org/t/high-cpu-usage/6171/7 "2022-08-14T11:17:57Z")

</div>

Any takeaways from this?

> [@Extremely slow contact management](https://forum.mautic.org/t/extremely-slow-contact-management/22075/7):
>
> Just of curiosity what version of MySQL are you running and have you done any optimizations like dedicating more memory etc?

---

<div class="post-metadata">

### Author: ![jribeiro](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/jribeiro/32/1003_2.png) [@jribeiro](https://forum.mautic.org/u/jribeiro)
#### Post date: [August 14, 2022, 11:40am UTC](https://forum.mautic.org/t/high-cpu-usage/6171/8 "2022-08-14T11:40:20Z")

</div>

To avoid these problems all cron commands are stopped… Mariadb is configured as per defaults.  
I can work in Mautic without any problem but once I access to -\>Channels-\>Emails I can not do anything more… the system hangs (I can only see the emails list). I can not go to other section "dashboard for example)… and Mariadb is getting to 100% CPU

 ![image](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/f/f2981a4a98bfe9a9c3f3052492c425a0cac7434c.jpeg)  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/a/a47e4486a6578e4c0b4e438fe9cfdeae408d6e13.jpeg)

Slowly is going up…

 ![image](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/e/eb3444b9b7949668227ff50cf643dd30094999ab.jpeg)  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/3/3a5d264f63289e10c7d8b57001df1c5666b1ae23.png)

By the way all mautic instances that I have in the server are hang because Mariadb is not responding  
I think since version 4 there is a “loop” in the code.

---

<div class="post-metadata">

### Author: ![jribeiro](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/jribeiro/32/1003_2.png) [@jribeiro](https://forum.mautic.org/u/jribeiro)
#### Post date: [August 14, 2022, 1:13pm UTC](https://forum.mautic.org/t/high-cpu-usage/6171/9 "2022-08-14T13:13:23Z")

</div>

Yes… I have in php.ini max\_memory\_size=1G. But memory is ok… is CPU what is really bad

---

<div class="post-metadata">

### Author: ![jribeiro](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/jribeiro/32/1003_2.png) [@jribeiro](https://forum.mautic.org/u/jribeiro)
#### Post date: [August 15, 2022, 8:35am UTC](https://forum.mautic.org/t/high-cpu-usage/6171/10 "2022-08-15T08:35:28Z")

</div>

Moved the db to a hosted and administrated by the hosting with MariaDB 10.5 and the result is the same… when enter in emails… the mautic system hangs ☹ . I can not send more mails. It is really a pitty

After many tests and the same problem I have rolled back the Mautic to version 3.3.5 (Thank’s god DB schema did not changed) and now everything works fine. For me it is clear that is a Mautic 4 bug

---

<div class="post-metadata">

### Author: ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)
#### Post date: [August 15, 2022, 11:04am UTC](https://forum.mautic.org/t/high-cpu-usage/6171/11 "2022-08-15T11:04:26Z")

</div>

What is the size of your email stats table?

---

<div class="post-metadata">

### Author: ![jribeiro](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/jribeiro/32/1003_2.png) [@jribeiro](https://forum.mautic.org/u/jribeiro)
#### Post date: [August 15, 2022, 11:20am UTC](https://forum.mautic.org/t/high-cpu-usage/6171/12 "2022-08-15T11:20:34Z")

</div>

The size I see in phpmyadmin is 475K

---

<div class="post-metadata">

### Author: ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)
#### Post date: [August 15, 2022, 11:50am UTC](https://forum.mautic.org/t/high-cpu-usage/6171/13 "2022-08-15T11:50:50Z")

</div>

Is this the number of lines?  
I would be interested in total GB.  
My theory is, that you have to many lines, that your Mautic can’t process the emait\_stats table.  
Possibly due to large images (or many small) used in emails, which now all stuck in the table.  
J

---

<div class="post-metadata">

### Author: ![jribeiro](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/jribeiro/32/1003_2.png) [@jribeiro](https://forum.mautic.org/u/jribeiro)
#### Post date: [August 15, 2022, 12:30pm UTC](https://forum.mautic.org/t/high-cpu-usage/6171/14 "2022-08-15T12:30:59Z")

</div>

Yeah 450K rows… and I have images in the mails of course. 2-5 images of normally 500X300  
So I should not include images in the mails? 😳  
So it works in 3.3.5 because the images do not go to the table?

---

<div class="post-metadata">

### Author: ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)
#### Post date: [August 15, 2022, 2:26pm UTC](https://forum.mautic.org/t/high-cpu-usage/6171/15 "2022-08-15T14:26:05Z")

</div>

I didn’t say you shouldn’t and that size is totally fine. Just trying to understand why your emails won’t open. Images go into the table, if it works fine in 3.3.5, then probably there is something in 4.+  
Just thinking of a workaround for you because downgrade is not an option.

---

<div class="post-metadata">

### Author: ![jribeiro](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/jribeiro/32/1003_2.png) [@jribeiro](https://forum.mautic.org/u/jribeiro)
#### Post date: [August 15, 2022, 5:23pm UTC](https://forum.mautic.org/t/high-cpu-usage/6171/16 "2022-08-15T17:23:00Z")

</div>

Just for clarification… It is not that emails do not open… it is when open the list of mails… I can not even sort them by id… once I enter in this screen below all the system hangs

 ![image](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/d/da9855223995d2bb7f222e97dfcafda3209c1c1a.jpeg)

---

<div class="post-metadata">

### Author: ![jribeiro](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/jribeiro/32/1003_2.png) [@jribeiro](https://forum.mautic.org/u/jribeiro)
#### Post date: [August 17, 2022, 10:51am UTC](https://forum.mautic.org/t/high-cpu-usage/6171/17 "2022-08-17T10:51:41Z")

</div>

Downgrade “was not an option” but finally after many many tests and tries… I had to downgrade to 3.3.4 again… Thanks God The 4.4.1 database works in 3.3.4 after doctrine:schema:update --force  
I could not test every single function, but the main ones are working… I missed the images of my mails… but I will load them again. At least the emails (text and format) still there…  
So this is allowing me to continue sending mails

---

<div class="post-metadata">

### Author: ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)
#### Post date: [August 17, 2022, 11:06am UTC](https://forum.mautic.org/t/high-cpu-usage/6171/18 "2022-08-17T11:06:21Z")

</div>

This is super weird, because I’m overviewing 80 installations right now and we don’t have this problem. Could be environment, or maybe even content of an email in the DB. Really hard to figure out.

---

<div class="post-metadata">

### Author: ![jribeiro](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/jribeiro/32/1003_2.png) [@jribeiro](https://forum.mautic.org/u/jribeiro)
#### Post date: [August 17, 2022, 11:25am UTC](https://forum.mautic.org/t/high-cpu-usage/6171/19 "2022-08-17T11:25:26Z")

</div>

I totally understand and I tried to avoid in the last 7 days to do weird things…  
But it is a reality that the same mails and the same info works fine in 3.3.4 and not in 4.4.1  
I do not know why… but it is a fact.  
I made several test to determine where was the problem… but for sure there is some queries that with my mails make the DB hang because high CPU use… (seems a loop)  
I tested different environements and different DB version… in private MAriaDB (10.6) hosted MariaDB (10.5) and it is the same…  
If someone is interested to see what happen… I am open to send the mautic DB (4.4.1) to test what is happening in the end could help not only me but also to know what is happening

---

<div class="post-metadata">

### Author: ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)
#### Post date: [August 17, 2022, 1:25pm UTC](https://forum.mautic.org/t/high-cpu-usage/6171/20 "2022-08-17T13:25:48Z")

</div>

And you said you had no weird entries in your logs, right?

[Next page](https://forum.mautic.org/t/high-cpu-usage/6171.md?page=2)
