[one-users] oned causes high cpu load with onemc

Rogier Mars rogier at fortytwo.nl
Tue Feb 23 03:40:30 PST 2010


Hi,

I've solved this problem by changing the php code to use the php- 
xmlrpc library. I've changed the function rpc2_request to use a xmlrpc  
library:

include("xmlrpc.inc");

function rpc2_request($rpc2_method, $rpc2_request) {
     global $rpc2_url;

     $request_elements = count($rpc2_request);
     $server = new xmlrpc_client('/RPC2', 'localhost', 2633);
     for($i=0;$i<$request_elements;$i++) {
         $vartype = gettype($rpc2_request[$i]);
         if ($vartype == "integer") {
                 $vartype = "int";
         }
         $struct[$i] = new xmlrpcval($rpc2_request[$i], $vartype);
     }
     $message = new xmlrpcmsg($rpc2_method, $struct);
     $result = $server->send($message);
     $response = $result->value();

     $response = xmlrpc_decode($response->serialize());
     if ($response && xmlrpc_is_fault($response)) {
         trigger_error("xmlrpc: $response[faultString]  
($response[faultCode])");
     } else {
         if ($response[0]) {
             return xml2array($response[1]);
         } else {
             return array(failed => $response[1]);
         }
     }
}

This solves the high cpu load on the oned.

I'd be very interested to hear if this change is helpful to anyone.

Cheers,

Rogier


On Feb 21, 2010, at 1:51 AM, Rogier Mars wrote:

> Hi,
>
> I've been experimenting with onemc. it runs and works great, but  
> from time to time it causes oned to get up to 100% cpu usage. When I  
> click through the interface, especially the vm's page, oned cpu load  
> goes up. The apache error log shows errors about xmlrpc timeouts:
>
> [Sun Feb 21 01:46:25 2010] [error] [client 86.89.220.92] PHP  
> Warning:  file_get_contents(http://localhost:2633/RPC2) [<a  
> href='function.file-get-contents'>function.file-get-contents</a>]:  
> failed to open stream: HTTP request failed! HTTP/1.1 408 Request  
> Timeout\r\n in /var/www/html/onemc/include/xml_funcs.php on line  
> 147, referer: http://93.188.248.232/onemc/users.php
>
> I've tried both the rpm binary and a manually compiled version. I  
> run one on 32bit CentOS5.4
>
> When using the one cli command, I've never seen this behaviour. Can  
> this be caused by the onemc, or the xml-rpc interface that the onemc  
> uses?
>
> Best regards,
>
> Rogier
>
> _______________________________________________
> Users mailing list
> Users at lists.opennebula.org
> http://lists.opennebula.org/listinfo.cgi/users-opennebula.org
>




More information about the Users mailing list