# Tuning mattermost for client performance

**URL:** <https://forum.mattermost.com/t/tuning-mattermost-for-client-performance/7153>\
**Category:** Troubleshooting\
**Created:** [April 25, 2019, 12:48am UTC](https://forum.mattermost.com/t/tuning-mattermost-for-client-performance/7153 "2019-04-25T00:48:49Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![gubbins](https://avatars.discourse-cdn.com/v4/letter/g/cab0a1/32.png) [@gubbins](https://forum.mattermost.com/u/gubbins)\
**Post date:** [April 25, 2019, 12:48am UTC](https://forum.mattermost.com/t/tuning-mattermost-for-client-performance/7153/1 "2019-04-25T00:48:49Z")

</div>

My server (mattermost 5.9, E10 licence) has about 500 users and runs on a single 8-core server. The CPU and memory usage of the server have always been pretty low. However, in recent weeks, users have noticed some operations have become slower, with delays of maybe 2-10 seconds on the following:

- loading a saved file / image
- loading messages on channel switching
- uploading an image (can now take 30s where previously it would be just a few seconds)
- loading the list of users in the direct-channel switcher

Just to be specific about this last point, the operations are:

- Shift-Cmd-K for direct message switcher
- Start typing a username
- It takes 3-10 seconds before the list of possible completions appears; late last year I remember this being instantaneous

I know that some of these issues began when I switched from local disk storage to S3 storage. This might actually explain all the slowdowns: for example I guess that the list of users in the direct channel switcher will require loading the users’ icons from storage. I am investigating the S3 configuration and network routing to see if we can improve that. I recently configured the S3 region and endpoint explicitly rather than the default (“Mattermost attempts to get the appropriate region from AWS”) which may help.

I suspect some of the issues relate to the speed of database queries. The database is Amazon RDS. The config items “Maximum Idle Connections” and “Maximum Open Connections” have been set to 10 ever since I set up the server. Is there any guidance on a suitable choice for these? I have tried increasing these to 50 as an experiment, and I notice that the number of active connections has immediately jumped to 23.

Any guidance on tuning this would be welcome!

---

<div class="post-metadata">

**Author:** ![gubbins](https://avatars.discourse-cdn.com/v4/letter/g/cab0a1/32.png) [@gubbins](https://forum.mattermost.com/u/gubbins)\
**Post date:** [April 25, 2019, 1:14am UTC](https://forum.mattermost.com/t/tuning-mattermost-for-client-performance/7153/2 "2019-04-25T01:14:46Z")

</div>

BTW the logs contain a lot of `context deadline exceeded` errors like this:

```auto
2019-04-25T10:08:10.337+1000 error web/context.go:52 Unable to get the channels {"path": "/api/v4/users/me/teams/sty844ch9tbipr4wiu7ezxgdmy/channels", "request_id": "gbxfwjsqkfrjdp7r6dbrm5kqnc", "ip_addr": "10.192.104.100", "user_id": "haf1pjznibycd8z6yun1acjrnc", "method": "GET", "err_where": "SqlChannelStore.GetChannels", "http_code": 500, "err_details": "teamId=sty844ch9tbipr4wiu7ezxgdmy, userId=haf1pjznibycd8z6yun1acjrnc, err=context deadline exceeded"}

```

I am not really sure what this means. It doesn’t seem to correlate with any specific slow operations. Maybe it’s relevant.

---

<div class="post-metadata">

**Author:** ![amy.blais](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/amy.blais/32/7481_2.png) [@amy.blais](https://forum.mattermost.com/u/amy.blais)\
**Post date:** [April 26, 2019, 1:52pm UTC](https://forum.mattermost.com/t/tuning-mattermost-for-client-performance/7153/3 "2019-04-26T13:52:16Z")

</div>

Hi @gubbins,

I’ll ask our team if they have further recommendations.

Also, since you’re on E10, you can also take a look at what our [customer support](https://mattermost.com/support/) offers.

---

<div class="post-metadata">

**Author:** ![amy.blais](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/amy.blais/32/7481_2.png) [@amy.blais](https://forum.mattermost.com/u/amy.blais)\
**Post date:** [May 1, 2019, 1:52am UTC](https://forum.mattermost.com/t/tuning-mattermost-for-client-performance/7153/4 "2019-05-01T01:52:09Z")

</div>

Hi @gubbins,

I haven’t heard feedback from community on this yet, would you like me to help open a support ticket and our support team could take a closer look at this?

---

<div class="post-metadata">

**Author:** ![gubbins](https://avatars.discourse-cdn.com/v4/letter/g/cab0a1/32.png) [@gubbins](https://forum.mattermost.com/u/gubbins)\
**Post date:** [May 14, 2019, 6:48pm UTC](https://forum.mattermost.com/t/tuning-mattermost-for-client-performance/7153/5 "2019-05-14T18:48:59Z")

</div>

Thanks @amy.blais, I think it’s a good idea to try the E10 support route. I have gathered some more specific info now so I’ll pass it on to them.

---

<div class="post-metadata">

**Author:** ![aagha786](https://avatars.discourse-cdn.com/v4/letter/a/ee7513/32.png) [@aagha786](https://forum.mattermost.com/u/aagha786)\
**Post date:** [June 2, 2020, 9:49pm UTC](https://forum.mattermost.com/t/tuning-mattermost-for-client-performance/7153/6 "2020-06-02T21:49:52Z")

</div>

Hi @gubbins, curious to see if you learned anything that you might be able to share with others.

---

<div class="post-metadata">

**Author:** ![gubbins](https://avatars.discourse-cdn.com/v4/letter/g/cab0a1/32.png) [@gubbins](https://forum.mattermost.com/u/gubbins)\
**Post date:** [July 18, 2020, 10:21pm UTC](https://forum.mattermost.com/t/tuning-mattermost-for-client-performance/7153/7 "2020-07-18T22:21:44Z")

</div>

Nothing very useful, @aagha786. I increased the database connection count to 50, and using the internal performance metrics I can see that most of the team we use fewer than that - while occasionally maxing out at 50. Our network team reviewed the routing to AWS services. Generally I’ve had less complaints since then.
