c# - Is caching as important with MongoDB as with MySQL? -
i writing c# http request server web game , using mongodb database. more efficient still cache whatever can in c# application? or faster request mongodb every thing. expecting around dozen selection queries per minute each active player, , maybe 1 or 2 save/update queries per minute.
"dozen selection queries per minute each active player" doesn't tell anything. have bearing we'd need know number of active players, amount of time each query taking, table structure, queries in use (including amount of data returned), statistics on server load, , others such whether using mongo's ability shard database, etc.
regardless, before setting type of caching i'd highly suggest start profiling system. need know bottlenecks are, if exist. isn't guess at, need hard , real statistics.
with information in hand can make determination whether need
- to make minor fixes code
- implement type of caching strategy
- shard database server across multiple servers
- rearchitect large swathes of code
- scale (buy bigger servers)
- or fix internal network issues.
point is, don't start caching stuff in hopes of getting performance increase later. caching increase performance kill depending on huge number of factors.
one other thing add here. if using web farm host request server complexity , hardware costs involved in caching data locally each independent web server grows drastically.
hardware costs go due increased memory requirements on web server(s) when trying keep data cached in memory on machines.
complexity increases when trying keep cached copies in sync don't become stale. imagine game require information 100% current. sites facebook , others can afford little out of sync. when game server goes out of sync have negative impacts on player usability.
assuming deploying single web server , single db server, adding caching capabilities now might cause huge amount of pain in event move multiple web servers and/or multiple db servers.
finally, if reason deploying single machine hosts both database , web server caching ludicrous.
Comments
Post a Comment