Q:

Soap Server - performance issue (might be SQLite related)

Yesterday I've posted question about SQLite performance issues ( Terrible performance in Zend Db PDO_sqlite insert and update queries ). After several tests It seems like the problem occurs only when methods are called through SoapServer (tried both native PHP SoapServer and Zend_Soap_Server classes).
Test case - calling 10 methods which use SQLite DB INSERT and UPDATE DB operations.
Here are several cases of how it works:
1.Through the controller - without using Soap server.  localhost:~0.3s,  remote server:~0.3s
2.Through the Soap server. 1st call. localhost:~1-2s, remote server:~7s!
3.Through the Soap server. Several calls. localhost:~1-10s, remote server:~7s
3rd case doesn't concern me that much, probably might be the local server performance issue. Important thing is that it works stable on remote server.
On the other hand, 7 seconds for simple 10 method calls is increadibly long. Obviously - part of this 7 seconds is client-server communication, as case 1 omits that, but i don't think It should be that slow!
For debugging I'm logging everything, and what seems to happen is that the same SQLite methods called in case 1, take 0.00x-0.02s, here last for ~0.15-0.45s.
What might be the issue? Is it normal thing that it slows down so drasticly when using SOAP? (It's my first soap server project).
EDIT: another important log fact I've found:
Information -2012-04-26 13:08:07.782679  Class: SoapController. Method: SoapController::hadleWSDL. Line: 18.
Information-2012-04-26 13:08:08.318641 * SYSTEM START UP * 
So that's basicly time between 2 methods being called. Over 0.5s for client-server communication with a little amount of data seems a lot to me. Here's the code for handleWSDL action:
$options = array(
    'encoding' => 'UTF-8',
    'cache_wsdl' => WSDL_CACHE_BOTH,
    'uri' =>$this->_WSDL_URI
);  
$soap = new Zend_Soap_Server(null, $options); 
$soap->setClass('SoapServerFunction');
$soap->setObject(new SoapServerFunction());
$soap->handle();

The application is really simple - SOAP method takes 1 parameter, and basing on it 1 cached object is created, data is being processed, and part of data is returned in XML format.
Thank you in advance for any suggestions what I can do to either make it faster or how to track what's the real reason of slowing down.
Best regards!

A:

Do you use a FQDN for the server's address? In that case it might actually be DNS-related. You might also want to try everything on a real system and not on a virtual host, as you will not have much control over what the physical system is actually doing.
Secondly, I would recommend installing xdebug and use kcachegrind or wincachegrind, which will give you a much more detailled view of what your system is doing.
Thirdly, you may log slow queries by utilizing PostgreSQLs pg_stat_statements().

