At the outset, to save the server, MongoDB and Redis are placed on a server. Every peak of the website special card, also often appear 502. Find the reason, found that hard disk writing data is very large, IOPS is very high, and then carefully study the monitoring, found that the operation of hard disk is very regular, every few minutes there is a frequent write hard disk, Lenovo to the Redis synchronous data to the hard disk interval is a few minutes, so began to suspect that Redis caused.
Then added a server, put Redis alone there, found that the site instantly, 502 problems no longer appear. As for the scenario of placing MongoDB and Redis on the same server with different hard drives, I have not tested it, and I think it should also have an impact on MongoDB, because Redis synchronizes data to the hard disk when it is more CPU-intensive. Redis server, is a quad-core CPU, when synchronizing data to the hard disk, CPU utilization of up to 60%, perhaps also with hard disk write performance is related to it, Redis very eat memory, very occupy hard disk IO resources.
MongoDB and Redis data cannot be placed on the same server