I am running a play framework application and a Postgresql server on a VPS which has 2vCores and 2GB of RAM and I'm having memory issues.
I limited my play application to 1024MB with the parameter :
jvm.memory=-Xmx1024m -XX:MaxPermSize=150m -verbosegc -XX:+PrintGCDetails -XX:+HeapDumpOnOutOfMemoryError
Which lets 1024MB of free memory for Postgresql and some system processes but I'm having freezes with some pages of my play application and I don't understand why (these pages usually load a lot of data from the database but the objects themselves are simple and should not use a lot of memory).
When I have these freezes my application is not always using all the memory allocated by the JVM, so I'm wondering if it's not Postgresql who is creating this issue by using too much memory.
Indeed, Postgresql has several processes (more or less 20) and about 5 of them take 6% of the memory each.
When I installed Postgresql I didn't change the default configuration (I'm new to Postgresql).
Could you tell me if my theory of Postgresql making my application freezing seems plausible? If so, how should I change my Postgresql settings (and eventually the play application settings) so that everything is optimized for my 2GB of RAM VPS and I get no more freezes?