I am experiencing issues with DrupalChat slowing down my server.

I noticed that the longer that I navigate my site, the longer the server was taking to respond. After researching the issue and talking with my hosting provider, I found a bunch of requests under the Apache Status in cPanel that looked like this:

POST /drupalchat/process-messages-long-polling HTTP/1.1

Based on my discussion with my hosting provider, it appeared that the module was spawning a bunch of processes with each page load that eventually slowed down the server to the point where it was not responding.

I originally had the polling method set to Normal AJAX, but then switched over to the long polling method, which seemed to help out quite a bit, but I am still seeing a performance issue that seems to be related to the module. If I refresh a single page a bunch of times it seems to quicken the process since I believe each new page load is creating a new request.

I am running DrupalChat version 6.x-1.2 with Drupal 6.16 core. I am setup on a linux server running CentOS 5.5 with cPanel 11.25. I'm not sure if there is an issue related to server configuration or the module itself. It is a newly configured server with virtually no traffic and only one site setup, so it shouldn't be an issue in terms of lack of resources.

I think that DrupalChat is a fantastic module and I would love to incorporate it into my site, however I need to be sure it isn't causing any performance issues. Any help you can provide would be greatly appreciated. Thanks!

Comments

fenda’s picture

The next big version should fix alot of performance issues. We appreciate your patience.

Starminder’s picture

Subscribe.

Good news: I got the Sep 7 Dev version to install and work right out of the gate (re: other issues where it won't even get installed). This is good news, I have a ton of modules installed and if anyone was going to have trouble, it was me.

Bad News: The performance was so bad my host shut me down "System administration was forced to suspend your site due to high CPU usage in an emergency to prevent server and system overloads. The source of this usage appears to be php scripts that run high numbers of MySQL queries. Your VPS is averaging 182 MySQL queries per second and using over 14% of the CPU on the node."

I'm looking forward to being able to use this, but need to know how if there is a configuration that would help avoid my site getting shut down in the process.

fenda’s picture

That's very bad news indeed. Are you using Long polling in drupalchat settings?
How many users were online on your site at that time?

darklrd’s picture

Looking into it.

Starminder’s picture

Some things I noticed while trying it:

Rendered fine in Firefox, Safari, and IE 8. IE6 & 7 users reported that it clashed with Dynamic display block and also did not render to a point of usability (no box to type into).

When set to Ajax, it did not display for me. Set to polling and then it worked. Tried changing setting from provided dark theme, when I did that it disappeared.

Hope that helps.

fenda’s picture

Will look into IE versions. Which version of dynamic display block are you using?

In Ajax mode you can't see the chat at all?

The Sep 7th release only worked on dark theme, we knew that.

And you didn't answer my previous question:
How many users were online on your site at that time?

Starminder’s picture

Sorry - this was only with 2 and 3 users at a time.

With Ajax, the box just didn't show up.

fenda’s picture

Ok I fixed drupalchat not showing immediately after Ajax being installed, will be in the next dev snapshot.
I'm also going to set long polling as the default option.

I'm still not able to re-create the huge amount of sql queries you had. One thing I am thinking of is that you have a tonne of queries in the hook_init() in your modules?
hook_init() is run every time drupalchat polls for new messages/buddylist changes.

Also, did the sql query overload occur on ajax mode or long polling?

Starminder’s picture

In my case it was long polling since Ajax wouldn't work.

white_pawn’s picture

Are you guys still working on that optional integration with ape?

darklrd’s picture

Yes :)

white_pawn’s picture

Woohoo! :) So, that one's going to be included in the upcoming release?

Abeaudrian’s picture

Hi
Great work, with this module I had the same problem as "cstump01" and a similar server configuration Linux and Centos 5. I had to remove Drupal Chat because of the same performance issues. I am just curious as to a time frame for a release which would resolve this challenge. Just so I can keep my eyes open, and re install to check for any improvements.

Regards

Adrian

fenda’s picture

Abeaudrian,

Could you please let me know which version you are using? The dev version?

Abeaudrian’s picture

Hi Fenda

I was using version 6.x-1.2. Does the development release fix performance issues? If it does, does it help significantly?

Regards

Adrian

darklrd’s picture

@white_pawn - It will take time to implement this. It might not make out in the next release.

darklrd’s picture

@Abeaudrian - Which method are you using for chat - AJAX or long polling?

fenda’s picture

Furthermore Adrian try the Dev version and see how your performence is on that.

Abeaudrian’s picture

Hi Fenda / darklrd

Which method is better? I am assuming long polling?

darklrd’s picture

Yes long polling is better.

karlitos’s picture

Hi there,

Today I installed this module. I found it very interesting for my site. After a couple hours playing with it and testing it between two computers (2 users) I recieved a server warning of CPU usage exceeded. I was totally shock, I could not understand what the hell was going on, specially since my site is not yet open to public, still in developing stage. I looked at the traffic stats and saw that the main index.php file was executed more than 9700 times. It was the first time it happened to me, after uninstalling the module, everything went back to normal.

I don't know if it's a module problem or that it gets in conflict with my site set up but it's the first time that an issue like this happens with our site.

fenda’s picture

How's the dev version for you on Long Polling mode? Try it out.

darklrd’s picture

Hello everyone,

Can you guys please tell us some of your web server (apache) configuration settings such as ServerLimit, MaxClients, KeepAliveTimeout, MaxKeepAliveRequests etc?

karlitos’s picture

Hi darklrd,

This are the test server settings we use for developing sites:

Operating System Linux
Kernel Version 2.6.28.5-grsec-sg2

Disk Space Usage unlimited MB
Bandwidth Transfer unlimited MB

Inode Usage 150000 max
CPU Time Usage 1000/hour max; 10800/day max
Account Executions(scripts, programs) 800/ hour max; 12000/ day max

Hope that can help!

karlitos’s picture

Hi Fenda,

to be honest I haven't tried it (dev version). Without a doubt I will, I really want this module to be working in the site, so once I finish the whole site I'll see how it works with this module.

ttbakiatwoam’s picture

Issue tags: +page, +views, +logs, +log, +logging

I am not having a performance issue with the user interface. However, Drupalchat has taken over my log messages and it is not sortable so that I do not have to look at them like PHP errors and Backtraceing. Can you add an option to keep Drupalchat from making log entries every time it checks for messages? I would like to know when they are sent so I can know if it is used but I don't need to know when it checks for new messages or can you add the ability to filter out those messages from the log view.

Specifically what I am looking at the track feature and looking at page views. It seems that every 2 seconds Drupalchat looks for messages and logs it as a page view. I do not mind that it does this I would just prefer if it did not clog up my logs when it does it.

I am using a linux shared hosting with PHP5 and Module version 6.x-1.2 using normal AJAX.
I know my refresh rate is 2 seconds thats why it checks that often but again I don't need logs for it.

Edit: Also would it be possible to link the names in the user list to their profiles? and could you support the realnames module? I know having first and last names came up in another module and the realnames module would be a good solution.

Just some thoughts... for improvement

This Module is great I love it and use it often these were just some things I noticed.

str1’s picture

Having also huge performance issues, I'm not sure but I think its memory leak / high usage. Sadlby because this would be probably the best chat module to use. Here are apache settings if any help (dont remember right now which mpm was in use):


StartServers 2
MinSpareThreads 25
MaxSpareThreads 75
ThreadLimit 64
ThreadsPerChild 25
MaxClients 150
MaxRequestsPerChild 0


StartServers 2
MaxClients 150
MinSpareThreads 25
MaxSpareThreads 75
ThreadLimit 64
ThreadsPerChild 25
MaxRequestsPerChild 0

darklrd’s picture

Priority: Normal » Critical

str1 thanks for the server details. This is indeed a very bad news. We will look into it.
Changing the issue to critical.

darklrd’s picture

@str1 - Which version of DrupalChat did you use? Is it the latest dev?

oxford-dev’s picture

Somwthing I have noticed with performance is that the _drupalchat_buddylist function (im sure the others too) is triggered dozens of times per page load. This must be incredably inefficient use.

fenda’s picture

Thanks for this I'll look into it.

fenda’s picture

After further trial and error, no matter how we look at the problem - long polling is not efficient 'out of the box'.

I'm going to start to implement Node.js for the long polling technique. This will allow a much much larger amount of connections and remove many of the issues described in this thread.

It's going to take a while. :)

darklrd’s picture

As mentioned by Fenda although long polling via AJAX has its limitations, we are working hard to resolve this issue and it will be fixed soon.

darklrd’s picture

We need a small feedback - performance issue is more dominant in which version of DrupalChat? Is it 6.x-1.2 or the latest dev version 6.x-1.x-dev?

pribeh’s picture

subscribing. looking to utilize this on a social networking site and performance is an issue. Thanks so much for your hard work on this module guys.

ManyNancy’s picture

Well no kidding, the annoying brat style polling was never going to work for anybody. That's why you need to integrate a solution like socket.io

bryancasler’s picture

subscribe

str1’s picture

Sorry for late reply, I tested the latest stable and latest dev, no difference between em, both got my server totally stuck. Havent tested latest dev though, but I have to wait for news about this because server is already on use. Only way to rescue from DrupalChat -performance issue is to boot the server so it's not possible right now.

More info about server, hope this helps to debug more:
HW type = VMWare virtual machine
Ubuntu = 10.04
Memory = 256mb
Php version = 5.3.2-1ubuntu4.5
PHP Memory limit = 96M
MySQL max_connections = 10
MySQL query_cache_size = 33554432
Apache = Apache/2.2.14
Apache modules = core, mod_log_config, mod_logio, prefork, http_core, mod_so, mod_alias, mod_auth_basic, mod_authn_file, mod_authz_default, mod_authz_groupfile, mod_authz_host, mod_authz_user, mod_autoindex, mod_cgi, mod_dir, mod_env, mod_mime, mod_negotiation, mod_php5, mod_reqtimeout, mod_rewrite, mod_setenvif, mod_ssl, mod_status, mod_substitute
Drupal Version = 6.19
Raw list of Drupal Modules (not all of them are enabled):

active_tags
activitystream
activitystream_facebook
activitystream_foursquare
ad
addtoany
admin
adminrole
adsense
advanced_help
advanced_profile
ajax
amfphp
atrium_features
author_pane
auto_nodetitle
autoassignrolecustom
autocomplete_widgets
backup_migrate
backup_migrate_files
better_formats
book_access
boxes
calendar
captcha
captcha_pack
casetracker
cck
cck_field_privacy
cck_fieldgroup_tabs
cck_private_fields
chatroom
ckeditor
codefilter
comment_upload
compact_forms
computed_field
conditional_fields
contemplate
content_profile
content_taxonomy
context
context_og
crayon
ctools
custom
custom_pagers
customcssjs
date
db_maintenance
designkit
devel
diff
drutalk
email
emfield
facebook_status
fb_social
fbconnect
fbsmp
fckeditor
features
feeds
fieldgroup_tabs
filefield
fivestar
flag
formfilter
front
getid3
globalredirect
google_analytics
i18n
im
image_caption
imageapi
imagecache
imagecache_profiles
imagefield
imce
inactive_user
itweak_upload
job_scheduler
jquery_impromptu
jquery_ui
jquery_update
jstools
l10n
l10n_client
languageicons
libraries
lightbox2
link
logintoboggan
mailcomment
mailhandler
markdown
markup
me
media_youtube
menu_breadcrumb
messaging
mimemail
mobileplugin
moduleinfo
node_gallery
node_repeat
nodeformcols
nodereference_url
nodereferrer
notifications
notifications_team
og
openidadmin
panels
panels_tabs
parser_ical
pathauto
phone
poormanscron
prepopulate
private_download
private_upload
purl
reldate
search_files
services
signup
simplenews
simplenews_template
sitedoc
skinr
slideshare
spaces
spamspan
strongarm
supercron
superfish
tabs
tagadelic
tagadelic_views
themekey
token
transliteration
ucreate
unlimited_css
user_relationships
video
views
views_attach
views_charts
views_customfield
views_gallery
views_groupby
views_slideshow
votingapi
webform

darklrd’s picture

Version: 6.x-1.2 » 7.x-1.x-dev

Good new: DrupalChat 7.x-1.x-dev now supports node.js backend! :-)
Commit: http://drupalcode.org/project/drupalchat.git/commit/15b37f6

agungsuyono’s picture

Just wondering if there's a 6.x version that supports node.js backend. Thank you.

darklrd’s picture

No, there isn't. Patches are welcome :)

Thanks!

Pilinha’s picture

I'm testing version = "7.x-2.8" and I've same problem, very bad performance with polling and AJAX options.
The CPU with AJAX options it's allways at 100% use, and with polling every minute have cpu peaks, collapsing my server.
I have maybe 300 users at same time in my webpage, so it is not working with so many users.
Some experience with node.js with better performance?
Thanks!

apaderno’s picture

Priority: Critical » Normal
Issue tags: -page, -views, -logs, -log, -logging