Notifications Performance

I have a strange issue with notifications on version Release - 1.8.19, Version - 2014012000 for an instance with about 300 users and groups with between 10 and 50 users.

1. Whenever I create content (e.g. create discussion, upload file, create calendar event), the page waits for notifications to be sent before returning control to the user. The notifications for 10 to 20 users could be between 10-40 seconds. No logged errors, no significant spikes in utilization of the server resources (CPU and Mem less than 7%). I think this is designed behavior.

2. If I disable non-bundled plugins the speed of notifications is still very slow. So its not a plugin conflict unless there is some residual effect of the plugin after deactivating.

3. If I disable notifications for users in the group, the speed changes to instantaneous. It does not matter with all plugins are enabled or not.

4. I have a vanilla install on the same versions and OS resources and it seems alot faster, so I am assuming the performance degradation is based on database record numbers etc.

5. If I disable the Notifications Core plugin, its still slow and i still get email notifications.

6. Seems like email notifications are main time issue... I will investigate a better email notifications method as a possible resolution.

Any thoughts or ideas on diagnosis is welcomed.

Brad

 

 

 

  • Everything you've stated is correct and is expected, the situation is much better for 1.9

    In 1.8 I have solved these issues for high volume sites by deferring the sending of emails to the system shutdown handler with the vroom plugin.

  • OK.. Thanks.. Waiting with 1.9 release with expectation :)

    Further analysis showed some of my stupidity. My delays were increased because of the configuration of the MTA. It was processing way too much in foreground and not returning control to elgg. Once I changed the config to increase background processing, the delays were greatly reduced. 

    There is still an idelay ssue with users clicking buttons more than once because of the delay from "Save" to a screen refresh, but I have enough of a solution until 1.9 I believe.

    Brad

  • Quick :) question (no such thing)..

    I looked at Vroom and it looks like it could be interesting short term. Not sure I have the skills to do it.

    I want to implement it for group discussion notifications. Discussions are a little special from what I can determine.. 

    Seems like I need to change start.php in mod/groups

    if ($interested_users && is_array($interested_users)) {
                                    foreach ($interested_users as $user) {
                                            if ($user instanceof ElggUser && !$user->isBanned()) {
                                                    if (($user->guid != $poster->guid) && has_access_to_entity($topic, $user) && $topic->access_id != ACCESS_PRIVATE) {
                                                            $body = elgg_trigger_plugin_hook('notify:annotation:message', $annotation->getSubtype(), array(
                                                                    'annotation' => $annotation,
                                                                    'to_entity' => $user,
                                                                    'method' => $method), $string);
                                                            if (empty($body) && $body !== false) {
                                                                    $body = $string;
                                                            }
                                                            if ($body !== false) {
                                                                    notify_user($user->guid, $topic->getContainerGUID(), $subject, $body, null, array($method));
                                                            }

    The notify_user line needs to change to something like;

    if ($body !== false) {
    elgg_register_event_handler('shutdown', 'system', 
        function () use ($user->guid, $topic->getContainerGUID(), $subject, $body, null, array($method)) {
               notify_user($user->guid, $topic->getContainerGUID(), $subject, $body, null, array($method));
        }
    , 500);
    }

    All normal disclaimers about not changing core elgg and this is a completely non-prod instances which I can easily break and restore.