HomeNotesDolphin-7.x Resource Hog FLASH xml member_queries browse.php

Dolphin-7.x Resource Hog FLASH xml member_queries browse.php

First of all this has been addressed and basically ignored --> http://www.boonex.com/unity/blog/entry/xml_php_resource_hog_confirmed_

 

it has not gone away, if anything it has gotten worse.

 

i think code satori mentioned there were a few areas where the xml.php file is located on the dolphin platform. the issue i am seeing is coming from basically two locations /flash/xml.php /modules/boonex/xml.php (might be wrong on this one, im tired, been staring at processes run for the past hour. the images will tell the story.

 

I monitored two servers, both are shared hosting environments with ~20 accounts hosted on each one. of those accounts, there are ~7 of those sites that have more than 5 members. there are two accounts that have in excess of 3k members, these are for testing purposes and are not jacked stolen, ripped off with the infamous mods that are sold here for that purpose.

To start with the site(s) images i am depicting have been edited to protect the account owner, i have blottered out the account name for their protection. the first site i am talking about here, has exactly 18 members, and none were online when the RESOURCE SPIKES were taking place.

 

dolphin-7-modules-resource-hog

 

what is the requirement here for the /modules/index.php to hit this type of CPU spike?

here it is again from another account and from same server. except this one shows the /flash/XML.php file acting up as well.

dolphin-7-modules-resource-hog

seriously what could the /modules/index.php need with 71% CPU? note the mysql process was included so you could see which machine this was coming from.

 

dolphin-7-modules-resource-hog

 

dolphin-7-modules-resource-hog

 

dolphin-7-modules-resource-hog

 

 

dolphin-7-modules-resource-hog

 

dolphin-7-modules-resource-hog

 

dolphin-7-modules-resource-hog

 

dolphin-7-modules-resource-hog

as you can see this is from a different server, and just watch how crazy this gets.32% really isnt that bad, and it really is only for a burst. but there is something causing this, and its not site activity, there is something in the application that needs to be looked at. why would a menu query on a site with no activity spike to 32% CPU. this just doesnt make sense. now this site really gets crazy, and i just dont understand this whole ordeal. this has been discussed and those of us who spent our time exploring and investigating were essentially ignored. that could prove to be the case on this go-round as well, but i sure hope not. there are accounts being suspended from the hosts who are listed on the recommend hosting page, irony, accident, or by design. so you grab a hosting package for $4.95/month two months later, you are told  you are suspended for excessive resource usage, and will need to upgrade to VPS. hmmmm, i will not elaborate on this because that is not what this is about to me at this moment, but you have all read the posts in the forums where members were suspended and told they would need to upgrade to VPS.

 

dolphin-7-modules-resource-hog

/flash/XML.php --> /modules/index.php --> /member_menu_queries.php. resource usage not all that bad  you might say on this one. not really, but again, there is nobody on this site, there is no activity on the site. so what is causing this?

dolphin-7-modules-resource-hog

 

without running an actual timer on these occurrences, i would guess that the time between spikes is about 1 minute. same files spiking the CPU.

 

dolphin-7-modules-resource-hog

 

dolphin-7-modules-resource-hog

 

now this spike is not something i see often, but thought it interesting the CPU spike with no users on this account at the time of the spike. logically how many people would you think would need to hit this blog at one time, in order to  knock off this type of resource? i dont have any idea, but these are not issues that can be managed from the server-side. this is directly related to the source code.

 

dolphin-7-modules-resource-hog

 

and i dont have a clue what the heck happened here. browse.php seriously guys, what would cause this, it certainly isnt traffic.

dolphin-7-modules-resource-hog

 

this is just an idea of what resources are used on the cron jobs. and if setup based on the required suggestion from the developers, to run every minute on the minute, this is heavily resource intensive. what is causing the CPU usage on these cron jobs? since they are running from the database, shouldnt they be more optimized than this? how come this only started with dolphin 7, this was not an issue with Dolphin 6?

View the Images offsite

 

this is not a bug report, this is not a complaint, this is a blog about what i see going on with the Dolphin 7 platform. there was an instance where we were told to turn off the profiler, then told to turn on the profiler. which is it, and what is causing these CPU spikes?

 

hopefully we can get some resolution. AlexT or any other developer who wishes to have access to my servers, please inquire, you can certainly take a look. i would also like to see the processes  that are running on the demo-dolphin site you guys run, because there were times when it was pegged out i am sure, and you have a great deal of members on that site. but a site with 18 members, should not be spiking the CPU +20% muchless the astonomical amount that you see depicted in these images.

 

Regards,

DosDawg

HoustonLively, i had to edit my post in order to provide a definitive answer.  since you are not allowed to add images to the post comments.

Disabled All Versions of IM

HL as soon as i read your inquiry, i went to check on the status. The above is what was being used. Then i just sat there and watched and it took ~15 minutes, but the results were astonishing:

 

Resource Hog Dolphin 7 appears to be IM modules

 

so as you can see, even though you killed all instances of the IM, there is still something running the /flash/XML.php file, and its still spiking the CPU. Weird thing is this is ~76 lines of code, and using 70% of the CPU.

 

I have this strong suspicion that the ilnes 17 - 22 have something peculiar to do with this CPU spike. Since the security mechanism was broken upon release, and nothing has been done to fix it, we were only told to disable it, and that they would get to it at a later date.

 

define('BX_SECURITY_EXCEPTIONS', true);
$aBxSecurityExceptions = array(
'POST.data',
'REQUEST.data',
);

 

now to see the entire /flash/XML.php file

<?
/***************************************************************************
*
* IMPORTANT: This is a commercial product made by BoonEx Ltd. and cannot be modified for other than personal usage.
* This product cannot be redistributed for free or a fee without written permission from BoonEx Ltd.
* This notice may not be removed from the source code.
*
***************************************************************************/
$sModule = isset($_REQUEST['module']) ? $_REQUEST['module'] : "";
$sAction = isset($_REQUEST['action']) ? $_REQUEST['action'] : "";

if(($sModule == "mp3" && $sAction == "screenshot")
|| ($sModule == "board" && $sAction == "transmit")
|| ($sModule == "games" && $sAction == "makeShot")
|| ($sModule == "livecam" && $sAction == "channelShot")
|| ($sModule == "photo" && $sAction == "transmit"))
{
define('BX_SECURITY_EXCEPTIONS', true);
$aBxSecurityExceptions = array(
'POST.data',
'REQUEST.data',
);
}

$sGlobalHeader = "modules/global/inc/header.inc.php";
if(!file_exists($sGlobalHeader)){ header("Location:install/index.php"); exit;}

require_once('../inc/header.inc.php');
require_once($sGlobalHeader);
require_once($sIncPath . "constants.inc.php");
require_once($sIncPath . "db.inc.php");
require_once($sIncPath . "xml.inc.php");
require_once($sIncPath . "functions.inc.php");
require_once($sIncPath . "apiFunctions.inc.php");
require_once($sIncPath . "customFunctions.inc.php");

$sModule = empty($sModule) || !secureCheckWidgetName($sModule) ? GLOBAL_MODULE : $sModule;

$sContents = "";
$sContentsType = CONTENTS_TYPE_XML;

if($sModule == GLOBAL_MODULE)
{
require_once($sIncPath . "xmlTemplates.inc.php");
require_once($sIncPath . "actions.inc.php");
}
else
{
$sModuleIncPath = $sModulesPath . $sModule . "/inc/";
require_once($sModuleIncPath . "header.inc.php");
require_once($sModuleIncPath . "constants.inc.php");
require_once($sModuleIncPath . "xmlTemplates.inc.php");
require_once($sModuleIncPath . "customFunctions.inc.php");
require_once($sModuleIncPath . "functions.inc.php");
require_once($sModuleIncPath . "actions.inc.php");
}

switch($sContentsType)
{
case CONTENTS_TYPE_XML:
//--- Print Results in XML Format ---//
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header ('Content-Type: application/xml');
$sContents = "<?xml version='1.0' encoding='UTF-8'?>" . makeGroup($sContents);
break;
case CONTENTS_TYPE_SWF:
header("Content-Type: application/x-shockwave-flash");
break;
default:
break;
}
echo $sContents;
$oDb->disconnect();
?>

 

then looking at this file, /flash/XML.php i see where it calls /modules/global/inc/header.inc.php and this file has what looks like a bunch of garbage code in it. why would you need to define the database parameters again for this file, and what is this exactly doing, and why. there is no user parameters, and there are no actual database queries here, so why would you need to have all of the database parameters here again, when  you have them in the /inc/header.inc.php file? why would we just not require /inc/header.inc.php in this instance.

 

/**
* Data Base Settings
*/
if(!defined("DB_HOST")) define("DB_HOST", $db['host']);
if(!defined("DB_PORT")) define("DB_PORT", $db['port']);
if(!defined("DB_SOCKET")) define("DB_SOCKET", $db['sock']);
if(!defined("DB_NAME")) define("DB_NAME", $db['db']);
if(!defined("DB_USER")) define("DB_USER", $db['user']);
if(!defined("DB_PASSWORD")) define("DB_PASSWORD", $db['passwd']);
if(!defined("DB_PREFIX")) define("DB_PREFIX", "Ray");
if(!defined("GLOBAL_MODULE")) define("GLOBAL_MODULE", "global");
if(!defined("MODULE_DB_PREFIX")) define("MODULE_DB_PREFIX", DB_PREFIX . ucfirst($sModule));

 

does that appear to be a bunch of garbage that is essentially useless?

 

there's some more of the story. i do see that the ones who should be reading this are avoiding this post. interesting to say the least. i think i will go invite the powers to come take a looksee.

 

 

 

 

 

 

Plussed by

 
 
 
 

Comments

Oldest First
|
Threaded
 
 
Please login to post a comment.
dolphin_jay
Again very nice write up from the last time you and i tested this almost 5 months ago. I just told one person that got suspended to un install simple messenger and there load went from 27% to 7% i think it was and they only had 15 members or something like that.

I then told them to un install the regular messenger to see what the load would be. have not heard back yet.

You know the new server i built at home had the same problem and i un installed those two modules and now i run at see more like .97% Yes point 97% on a quad core amd running at 4ghz and 8 gig or 1600mhz ram.

So if two little silly modules can bog down a computer of this size then AGAIN i have to say there is something wrong. I wish i could just tell you how and where to fix it but, it truly needs to be fixed.

I also had the same thought in mind - was this built in, was it by mistake, was it just a bad string of code some place... who knows.

If I ever remember to take some screen shots of my cpu load on a server thats not even online by the way I will post them as well...

Thanks again for the nice pics and info.
houstonlively
Do you suppose this is related to the tons of cron emails I get about Mysql errors. It's not like my site has any traffic.
CodeSatori
If it seems like too much to tackle, outsourcing the fix may be an option worth looking into. I'm sure there are developers who can crack it straight for a reasonable price, and considering the trouble it's causing to customers here, the investment would no doubt be worth every penny.
dolphin_jay
@CodeSatori

If i had the funds to fix this "BAIT and SWITCH" tactic, i would do it for sure. Any idea on what you would charge for this ?
houstonlively
My access log gets filled by entries like this, which occur every 5 seconds.

xx.xx.xx.xx - - [18/Aug/2010:13:31:00 -0400] "GET /flash/XML.php?module=im&action=updateInvite&recipient=3&_t=1282152666655 HTTP/1.1" 200 70 "http://mysite.com/" "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.8) Gecko/20100722 Firefox/3.6.8"

I disabled the IM module to see if things get any better
CodeSatori
"updateInvite" in /flash/modules/im/inc/actions.php queries the database, here's the relevant code. Comments to follow.

$rResult = getResult("SELECT `SenderID`, `Message` FROM `" . MODULE_DB_PREFIX ."Pendings` WHERE `RecipientID`='" . $sRspId . "'" . $sBlocked . " ORDER BY `ID` DESC");
//--- if there is a message return it and some information about it's author ---//
while($aMsg = mysql_fetch_assoc($rResult))
{
$aUserInfo = getUserInfo($aMsg['SenderID']);
$sContents see more .= parseXml($aXmlTemplates['message'], $aMsg['SenderID'], $aUserInfo['nick'], $aUserInfo['profile'], $aMsg['Message']);
}
CodeSatori
In the above and the surrounding code inside the same "updateInvite" action, if you follow the trails, here's what happens when it runs:

- Database query for new messages
- Database select query inside function getBlockedUsers()
- Database select query and data processed inside function getUserInfo()
- Data parsed into XML via function parseXml()
- Database delete query

If you do all of the above at 5 second intervals, and dozens of users are online, it will definitely take its see more toll. Remedies off the top of my head:

- blockedUsers and userInfo data should be cached, not requested again and again
- delete query can be removed if message select query narrows by > datetime since last query, cleanup left to a cron job

This would drop SQL queries from 4 to 1, which is a dramatic difference in terms of performance. Moreover, actions recurring on rapid intervals should be isolated into smaller interdependent file subsets, and called as such only, to escape the otherwise large overhead.
CodeSatori
@dolphin_jay: Here's me wondering if I just cracked a good part of it in the last 15 minutes. With reference to my note on "smaller file subsets" that handle this independently, XML.php is a good illustration of the problem:

If you open up /flash/XML.php and read through just the files it requires — no less than 16 external files required, and I dread the thought of going to look them all up to see how much processing overhead they may produce, aside the obvious memory consumption see more from all the unused functions loaded into memory.

Call the above action (four SQL queries) through the heavy XML.php at 5 second intervals, multiply by a few dozen users, and it's a small miracle if your server isn't crawling.
houstonlively
This happens every 5 seconds even with the IM module disabled. (I'm using URL Snooper to watch it) I don't get it. It's a pretty good bet that there will be no new messages with the messenger module disabled.
dolphin_jay
Very Nice will give it a go in a few. Just playing with a wiccle first !
CodeSatori
The 'updateInvite' action calling XML.php is called from /modules/boonex/messenger/classes/BxMsgModule.php at line #138 in function serviceGetInvitation(). See what happens if you comment out the javascript making the call.

Strange thing is, I can't find any other references to 'updateInvite' or 'serviceGetInvitation' in the code, including no explicit call to serviceGetInvitation() for creating the javascript that should call the 'updateInvite' action.
houstonlively
I must confess complete ignorance as far as IM and messenger stuff goes. It's something I have given zero thought until today.

So... I have a Boonex 'Messenger' module, a Boonex 'Simple Messenger' module, and a Flash IM module.

Can someone explain to me wtf we need all these messenger modules for? Uninstalling the 'Messenger' and 'Simple Messenger', and disabling the flash IM seems to have shut everything up. I'm quite content to leave it that way.

Dawg, can you check to see if my see more resource usage has dropped any?
DosDawg
HL,
i posted a response to your inquiry, back to the original post, because i am not allowed to provide images here. so go back to the original post, and you will see two screen shots. not as bad as it was yesterday, but not what i would consider great either. the /flash/XML.php file is spiking ~15 minutes. so there is still something going on.

i also added some information on what i was seeing in the /flash/XML.php and what it requires, then looking at some of the files that are required, the see more unnecessary defines that are on the /modules/global/inc/header.inc.php file.

at any rate. sure wish we can attract boonex attention to this.

Regards,
DosDawg
CodeSatori
@houstonlively: I suspect all the different messengers are communicating between themselves, because you're not talking to them! Perhaps something new is emerging in the darkest abysses of the codebase... It may be AIRH, or an Artificially Intelligent Resource Hog. I'd get one of those anytime, put it in a cage, and watch it hog around all day long!
LeatherSportB
I think there is a TON of room for improvement for what amounts to AJAX requests for notifications and chat messages.

CodeSatori is on the right track with what he found. Something to think about, XML parsing can use a lot or resources. For the type of data that is being returned are all of these includes, functions, templates, and parsers really needed?

What if there was a very simple 'pending notices' table and instead of issuing multiple requests for different information across may tables see more requiring lots of steps every few seconds, the client simply asked 'is there anything waiting for me?'. The notice table could even contain a 'pay load' field so there is no need to do an additional request if there is something waiting.

I see the issues as two fold, updating the server side to this new table and updating the client so you only have one thing polling the server (kind of like Apples push notifications) that can check for notifications, then trigger the required client side feature.
houstonlively
@ CodeSatori You are probably right about the messengers talking to each other. I should probably also delete their files from the server so they don't attempt to reinstall themselves. I any case, if I ever decide to launch a DOS attack against myself, I now know to just reinstall the messenger modules.
DosDawg
I have invited the following boonex Staff to review this with us. hopefully they can find a moment to help us out:

Andrew
AlexT
Igor
AntonL

of these four, we would hope that we could find an answer with this issue, and not declare it as an enhancement to not have the CPU spiked on the server.

Regards,
DosDawg
DosDawg
wanted to make sure this discussion is picked up in conjunction with my ramblings. there are many who as deano states, know about this problem, and there has not been a fix for it. when this was mentioned earlier to one of the boonex team members, i was told they were working on 7.0.3 bugs, and getting that ready.

well the problem here and i was actually told thank you, is that this has been a persistent problem since the release of Dolphin v7.0B, it has been widely discussed and swept under see more the rug so-to-speak, so something is weird here.

we are awaiting the answer on this, and there are many who will be very happy when resolution is found for this problem.

REVIEW please --> http://www.boonex.com/unity/forums/#topic/load-on-the-server.htm

Regards,
DosDawg
sergey14
God grant us all patience
sorry for this post
houstonlively
You should be. It's pointless.
AlexT
PHP consumes as much resources as possible to execute script faster. So it can take 100% of one CPU, but it takes only 0.1-0.5 seconds.
So - any php script consumes some considerable amount of CPU when it is executing, but it is lasting very fast.

The reason that you see XML.php in the processes is that this file is executing more often than others (every N seconds from each user) ... since it is executing more ofter it is more likely that this file will be in processes list.

I will try see more to have a deep look at this call, to see how to optimize it, but it can not be done too much. The most useful things in this case are increase delay between calls (from 2 sec to 5 sec for example) and optimizing the server by installing some php accelerator and make sure that mysql cache is enabled.
 
 
 
PET:0.079782009124756