I am using PostgreSQL 9.3 server on my production server. Everything had been working fine for the past couple of months. But since the past week or so, PostgreSQL seems to have becomes very slow with increased CPU and Disk usage.
Here is the graph of CPU, Disk and Bandwidth usage over the past month
I'm using memcached to cache most of the queries. Web pages with few basic queries are faster while pages with complex queries take a lot of time. The server response time for such pages has increased from 0.2 seconds to 4 seconds (measured using Google PageSpeed Insights).
Following is my postgresql.conf tuned using PgTune.
default_statistics_target = 50
maintenance_work_mem = 60MB
constraint_exclusion = on
checkpoint_completion_target = 0.9
effective_cache_size = 704MB
work_mem = 6MB
wal_buffers = 8MB
checkpoint_segments = 16
shared_buffers = 240MB
max_connections = 80
Any ideas on what could have gone wrong? My website is a Django application hosted on DigitalOcean (1GB Ram, 30GB SSD Disk, Ubuntu 14.04 x64).