Differentiate in memory allocation per user
-
Hi,
I notice that when I log in as an admin user, my WP website needs at least 200 MB of memory, but when non-logged in anonymous users visit my website, 128 MB is enough for them to serve the pages. To save on simultaneous memory usage on my server, I find it a waste to just allocate 200+ MB to all users, so I thought of making a difference between logged-in users and non-logged in users.
Is this in any way a bad idea? Am I overlooking things? At first sight it seems to work. Below is the code I use, I can not use WP core functions during wp-config.php (like is_admin()), so I do this instead in wp.config.php:
/* experimental memory differentiation */ if( strpos( $_SERVER['REQUEST_URI'], 'wp-admin' )) { // limit for admin define( 'WP_MEMORY_LIMIT', '256M' ); define( 'WP_MAX_MEMORY_LIMIT', '256M' ); } else { // limit for anon users define( 'WP_MEMORY_LIMIT', '128M' ); define( 'WP_MAX_MEMORY_LIMIT', '128M' ); }
Love to hear your opinions on this.
Cheers.
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Differentiate in memory allocation per user’ is closed to new replies.