Some of the interview experiences of PHP programmers interview a vertical community-based startup company yesterday, one of which is the question [how to achieve sharing sessions with multiple servers]. this question made the interviewer very dissatisfied with the answer.
Sessions on multiple servers are shared. after the conversation, the intention of referring to the interviewer's question is that sessions between multiple servers are shared and synchronized in real time. so one of my ideas is to save sessions to the SESSION database, all sessions are stored. The interviewer is not satisfied. he refuted how to solve the problem if the concurrency is high.
In segmentfault, all the answers to this question are redis and memcached. in this way, sessions on multiple servers cannot be shared. In fact, what the interviewer wants to know is similar to the [cloud SESSION] function. In reality, there are not many such scenarios, and all servers can completely share real-time. At first, I got this question by myself. I thought too much about it. The first thought was that multiple servers in the SESSION shared in real time. after the answer was stored in the db, the interviewer repeatedly stressed the high concurrency.
In fact, the real solution can refer to the game server, server division.
If the concurrency of the game server is large, it is impossible to keep the players in. When the capacity limit of the server is reached, a prompt is displayed, indicating that the server is full and cannot enter. At the beginning, I said,"Consider whether the hardware configuration and bandwidth meet the current needs.",This sentence makes the interviewer more dissatisfied.. In reality, in many cases, increasing hardware configuration and bandwidth can greatly reduce the concurrency pressure, and then optimize programs and servers to solve the concurrency problem, instead of simply using PHP, you can only use this part of the program. Many IT companies use 2G 4G memory, dual-core CPU, and hard disks instead of SSD, but they talk about the so-called concurrency.
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.