php - Using session (memory) vs revalidation (CPU) -


i have web page plots data points on visible area of map based on set of fifteen criteria. user can pan or zoom map, trigger ajax call database, via query script, generate new data based on criteria , bounding box of viewable area of map. current implementation such criteria validated once, via validation script, , stored in $_session array loaded onto query script (unless criteria changes). validation script consists of series of preg_match function , conditional if...else statements.

another way can implement above save memory having query script validate fifteen criteria every time user moves map. trade-off higher cpu consumption validation in exchange of lower memory usage doing away $_session array. how quantify trade-off between these 2 options decide better approach given there many users connecting server @ 1 time.

the way reliable data test both implementations simulating expected peak number of concurrent users.

if not feasible, i'd recommend caching (session), since easier (and cheaper) add ram more cpu power.


Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -