GM-Alex / user-access-manager

Official mirror of https://plugins.svn.wordpress.org/user-access-manager/
39 stars 18 forks source link

Performance issue #233

Open raalahmmad opened 6 years ago

raalahmmad commented 6 years ago

Hi Thanks for the efforts. it is very useful plugin. However, we have experiencing some slowness in the wp site when the plugin is active. actually the average response time is 4 seconds, and when disable the plugin the average response time becomes 900 ms only. Any thoughts?

Regards Raed

GM-Alex commented 6 years ago

Please try the caching settings at the plugin settings.

GM-Alex commented 6 years ago

@raalahmmad Did that solve your issue?

raalahmmad commented 6 years ago

yes, some performance gain after enabling caching. Actually there are three methods for caching: PHP serialize, Json and PHP var_export. I'm not sure what is the difference between them - I'm looking for documentation - so I'm trying them one by one and monitor. Please let me know if you have any advice.

Many thanks for your prompt response and follow up, Raed

GM-Alex commented 6 years ago

If you are using opcache I would recommend to use var_export, see https://blog.graphiq.com/500x-faster-caching-than-redis-memcache-apc-in-php-hhvm-dcd26e8447ad

raalahmmad commented 6 years ago

Hi, Thank you for your follow up,, and sorry to go through this again. With caching enabled still the site is slow under normal load. when I disable UAM plugin then site performance is good, and when delete UAM files (delete UAM) the site becomes in excellent performance. The site is extranet with 20,000+ users and 600 pages dual languages

Your support really appreciated Thank you Raed

GM-Alex commented 6 years ago

20,000+ users and 600 pages dual languages is heavy so I would say a custom caching solution is necessary. Maybe the file blocking could be also an issue. So try disable the file locking, if that helps you could enable mod_xsendfile for Apache (https://tn123.org/mod_xsendfile/) or XSendFile for nginx (https://www.nginx.com/resources/wiki/start/topics/examples/xsendfile/). I think that could do the trick.

raalahmmad commented 6 years ago

Hi, After some investigation around this I found that for each page rendering UAM is querying db for 110 times. like these queries: SELECT option_value FROM wp_options WHERE option_name = 'uninstall_plugins'

SELECT ID FROM wp_uam_accessgroups

FROM wp_uam_accessgroups WHERE ID = 3 LIMIT 1 SELECT object_id AS id, object_type AS objectType, from_date AS fromDate, to_date AS toDate FROM wp_uam_accessgroup_to_object WHERE group_id = '2' AND group_type = 'UserGroup' AND object_id != '' AND (general_object_type = 'post' OR object_type = 'post') AND (from_date IS NULL OR from_date <= '2018-05-08 13:51:20') AND (to_date IS NULL OR to_date >= '2018-05-08 13:51:20')

I'm not sure if this is the normal behavior of the plugin, is there a way to combine each group of queries in one using join instead.

Thank you Raed

madpipe commented 6 years ago

I have the same issue. Speed impact. Functionality of the plugin is perfect - lovely, lovely stuff. Well done.

Caching is hardware cached at our host (getflywheel) and being managed hosting we're forbidden to use caching plugins. I've enabled caching in the plugin. I think this may have to do with the type of queries the plugin is using. Some queries really tax the database. Anyway, maybe using a different query type to check for access/no-access would speed it up?

dukaan commented 6 years ago

Any new insights on how to improve performance with this plugin?

I have a site with many many user groups created by this plugin and much content that needs to be restricted (500+ posts) and the slow down is too high (5-8 seconds to edit a certain post for example). Functionality is perfect though..

Phil-Avalon commented 5 years ago

Can I add my vote to the functionality? I love the ease of use and the capability of the plugin.

Just checking on how did the above conversation play-out? I don't see anything in the changelog that addresses performance since it was raised above. Is this something that Alex is looking at? Are there any plans?

Very many thanks, and PLEASE keep up the great work!