Discourse site with very large database gives error 502 frequently

i am getting sidecick error while 4gb ram plus 6 gb of swap is there