sweekrut.joshi
BAN USERScale on same server
1. Use event driven model. There are dedicated threads to perform IO and CPU bound activities. This way, incoming network traffic wont get effected by timer object cpu activity.
2. Make use of event driven socket programming. Use artefacts like epoll, IOCP, kqueue.
3. By properly implementing the above (event driven, multithreaded, lock free DS and memory management), one can achieve 10k concurrent clients on a single commodity server.
Using more than one server
1. Have the client connect to a gateway
2. This can load balance between more than one server (LAN).
3. Gateway will thus manage server loads and can start up more servers in-case all servers are getting loaded. This can be achieved by notifying admin or loading dlls on server machines
We can have more than one gateway and a load balancer (hardware lvl) can be added before the gateway which load balances among the gateways. This will also make sure that gateway is not the single point of failure.
If we write code using while(1) and while(2) and generate their assembly instructions (without using any compiler optimization options), both assembly turn out to be the same. Furthermore, if optimization options are added while compiling, both will get converted to the same set of assembly instructions. Thus it shouldn't matter which one is used.
- sweekrut.joshi September 26, 2016Note: This is not the case in all scenarios. Ex - ++i is faster than i++ (check out the assembly, latter one has one extra instruction).