consolibyte / quickbooks-php

QuickBooks Integration for PHP
Eclipse Public License 1.0
458 stars 338 forks source link

Persistent HTTP connections / connection reuse #292

Open WiredWonder opened 4 years ago

WiredWonder commented 4 years ago

Hi there,

I am running a large sync workload and wondering why the SDK is opening/closing hundreds of HTTP requests.

Is it possible to make the SDK use persistent connections, like http://technosophos.com/2012/06/18/connection-sharing-curl-php-how-re-use-http-connections-knock-70-rest-network-time.html ?

Cheers, Jason

WiredWonder commented 4 years ago

I managed to get this working by modifying HTTP.php to make the curl handler $ch global so it can be reused. Performance more than doubled when making repetitive API calls.

Now only one SSL connection is negotiated per running instance of the connector and it is reused for the life of all API calls.