Monthly Archives: May 2014

Parallels Automation use XML-RPC via PHP to get data from system

Parallels Automation is shortly OSS/BSS system which you can integrate , automate everything how you want via APS packages , you can find out more from this link.

I’m so new programming and want to start understand how to communicate/manage with 3th party system with REST API , XML-RPC.  Parallels have a XML-RPC to communicate with it externally alsso i expect to learn PHP with this integration.

Lets start ;

You can find out all Parallels Automation documentation from this link.

At the startup please read what is XML-RPC and how is looks like.

I do not have enough experience about PHP but to find out good explanations about PHP Tools please check the book ” Essential PHP Tools: Modules,Extensions and Acceleratiors”

tcpdump , yes, tcpdump its very very important because after long time i discover that sending wrong things and because of this i couldn’t query the Parallels Automation.  My environment is ; code uploaded to linux server which cpanel run on it , use pear and on the console executed command bellow to understand what XML-RPC request i am sending to RPC Server.

tcpdump -nl -s 0 -A -i eth1 -c 500 port 80
You can see that , your request will appear like below, its important because you will see many many XML-RPC request examples with PHP and every example do not work how you expected because of it i wasted almost a day until think to use debug somehow to see what i am sending (very clever yeah :))) )

Screen Shot 2014-05-30 at 14.39.51
Also i learn a lot about PHP , of course its nothing but its good start for me
First before start need to understand what kind of XML-RPC request i will send to Parallels Automation . Open the API pdf from link i already described above and choose one of method , i choose the method below
AccountDetailsGet_API
First need to read example to what kind of request need to send  what response you will get , use curl from cli with such xml file and memory the request and response.
This is the file ;

vahric:Apicall vahricmuhtaryan$ cat accountdetail.xml

<?xml version=”1.0″ encoding=”UTF-8″ ?>

<methodCall>

<methodName>Execute</methodName>

<params>

<param>

<value>

<struct>

<member>

<name>

Server</name>

<value>BM</value>

</member>

<member>

<name>Method</name>

<value>AccountDetailsGet_API</value>

</member>

<member>

<name>Params</name>

<value>

<array>

<data>

<value><i4>1000019</i4></value>

</data>

</array>

</value>

</member>

</struct>

</value>

</param>

</params>

</methodCall>

 

this is the curl command from cli

curl –connect-timeout 10 -d @accountdetail.xml -H ‘Content-type:text/xml’ http://192.168.179.2:5224/RPC2

and this is the result

<?xml version=”1.0″ encoding=”UTF-8″?>

<methodResponse><params><param><value><struct><member><name>Result</name><value><array><data><value><array><data><value><i4>1000019</i4></value><value><i4>1</i4></value><value><string>Son Mohican</string></value><value><string>Son Mohican address 1 </string></value><value><string></string></value><value><string>istanbul</string></value><value><string></string></value><value><string>34349</string></value><value><string>tr</string></value><value><string></string></value><value><string>Vahric</string></value><value><string></string></value><value><string>Muhtaryan</string></value><value><string>vahric@doruk.net.tr</string></value><value><string>90</string></value><value><string>212</string></value><value><string>3269200</string></value><value><string></string></value><value><string></string></value><value><string></string></value><value><string></string></value><value><string></string></value><value><i4>1401023839</i4></value><value><i4>2</i4></value><value><i4>0</i4></value><value><i4>1</i4></value></data></array></value></data></array></value></member></struct></value></param></params></methodResponse>

 

Now we have to prepare same request via PHP to query and get same result  , i explained the command inside the code with //
<?php
// All usable XML-RPC functions are inside RPC.php , please include it in your code
require_once ‘XML/RPC.php’ ;
// its good to activate/increase the level of error reporting
error_reporting(E_ALL);
ini_set(‘display_errors’, true);

//We have to describe RPC server access informations , in this example my RPC Server is 192.168.179.8 and listening 5224, because of related server also work

//for different things generally its url is described RPC2, if you want to know what is RPC2.
$xmlrpc = new XML_RPC_Client( ‘/RPC2’, ‘192.168.179.8’, 5224 );

//Need to construct XML-RPC request, you know some Name and Values we have to set

// <struct><member><name>Server</name><value>BM</value></member>
//struct is kind of value type , you can see the its have something inside <member> tags
//new XML_RPC_Value create values
//”Server” => new XML_RPC_Value(“BM”, “string”) is key and value pair and we are using => because of our value type is struct, means Server is key
// BM is value and its type string
// Important part is Params section  , you will see another array is created because get many value inside and all are under <data> tag but you can see that
//There is no <data> tag described like inside accountdetail.xml because its automatically added to request , read http://xmlrpc.scripting.com

params = array(new XML_RPC_Value(array(

“Server” => new XML_RPC_Value(“BM”, “string”),

“Method” => new XML_RPC_Value(“AccountDetailsGet_API”, “string”),

“Params” => new XML_RPC_Value(

array(

new XML_RPC_Value(1000019, “int”)

), “array”)

),  ‘struct’ ) );

//We almost have same view of accountdetail.xml
//With XML_RPC_Message we %100 construct the accountdetail.xml  file means request , first value Execute is XML-RPC Method, you can see many example

//like XML_RPC_Message(‘system.load’);
$msg = new XML_RPC_Message(‘Execute’,$params);
//Now need to send request to XML-RPC server
$resp = $xmlrpc->send($msg);

//Get the response and out it inside veritable (here i used value as veritable )

$value = $resp->value();

//When you execute the php file you will get response as a object
//object(XML_RPC_Value)#34 (2) {
//                   [“me”]=>
//               array(1) {
//                 [“i4”]=>
//                 string(10) “1401023839”
//               }
//Need to convert object to array to use it
//XML_RPC_decode do it for you
$m = XML_RPC_decode($value);

//You can print it to see
print_r($m);

//I told you I’m so new to programming , try to understand key(s) to access array
//you will see that some subarray will be in the result
//print_r(array_keys($m));

I learned that array key is Result and all values are under the subarray which key is 0 and i tried to access second element which is the name of the account
echo $m[‘Result’][0][2];

?>
Hope this help to who use PA and need to make XML-RPC query and new programers to discover how to make XML-RPC request(s) with PHP
VM
Advertisements

Sometimes storage IOPS , latency and cpu usage can not say something about the reason of performance issue on MSSQL

We faced very interesting customer complaints about MSSQL server performance

Problem is related sp run very slow and the source should be the virtualization 😦

At the startup its looks like very common complaints and how storage and system admins do check the storage side like global read and write latency on storage , related sql server LUN based latencies , cache configurations , frontend (host latency) and backend (disk subsystem latency )  also on server site via Resource Manager check the cpu , ram usages and also disk latencies too ! Nothing wrong …

As a system guy , usually focused on sp and check the whats going on , how to tune the sp bla bla . By SQL admin some tunings done and its effect the overall process but its was not enough. Asked so much guys about how to deeply understand the issue , mostly the answer is use profile manager or check the execution plan, find the cost and try to do it better

Then we discover the how to see the Process and Resource Waits , problem is mostly described is about not often but problem could be indexes but mostly disk bottleneck which is looks like impossible storage point of view because we do not try only on the SAN, DAS with different level of raid levels and number of the disk almost have same results also MSSQL run on physical server too !

Screen Shot 2014-05-08 at 01.28.20

 

Screen Shot 2014-05-08 at 01.30.06

 

The last thing is move everything %100 SSD Volumes , wait times are decrease incredible and SUSPENDED things are start to happen less then before

Now you can say to me that really the problem is disk , san  , raid , rpms or similar things but still i do not believe that the problem is non-SSD disks or arrays because there is no so much io , write latency any cache latency or SAN Network latency but single SSD solution somehow solve all things.

What i learned, its not enough to check MSSQL performance via only some very usual values like latency, cache and IOPS

VM