The problem of MYSQL latency is delayed

Hello,

I have 1gb ram vps and I currently have chat room that is based on php and mysql.

What is happening is that sometimes users can not see the message sent by them and they are falling behind.

How to know what is the cause of this problem? When I see my vps box, there is always 400 MB free or 300 MB free but delayed.

Could someone please give me some clue as to what is causing this?