Hello Guys,
im writing this post because I need a help.
I created chat application for my client and in first 5 month we have about 7M dialogues and 30M messages and 50-70 users writing messages at the same time... and my application slow down... and it looks like a growing trend will be the same or faster in future.
In general it is simple app with instant chats in rooms 1:1. Message can be plain text, one of provided gifs or uploaded image. Users Can softdelete messages on their side and in addition chat shows which messages are seen (WS in background)
About archotecture:
So for now its just one Laravel instance on one dedicated server with one MySQL DB on the same dedicated server
(slave server is synced continuesly)
Here we have simple DB structure:
messages >- dialogues >-users (divided into sender and receiver)
messages >-users (divided into sender and receiver)
[Im using indexes on most of fields]
Important info is that many times user started using portal and writing by 3-4 days and gone for many weeks or months or for forever. Rerely users are active for many weeks or months. So many of messages are in DB but probably will never by displayed again...
How I can start some optimisations ? How should I change approach? change DB engine? split table in very old messages and currently used messages ? partitioning DB? DB cluster? archive very old messages to other DB or txt file ? some other cleaver way?
I have many ideas but I totally dont have expirience with handling tons of data.
Each hint/help will be very usefull!
Thank U
K