5/8/2014 6:59:00 PM
I am trying to make use of the SecretServer API using SOAP and PHP however it's too slow to tolerate.
We have an internal site that users can go to in order to get the passwords for a specific server. That server has 10 passwords for various apps that it has running on it. We use SOAP and PHP to get the passwords and display them to the page. Because we have many servers that do this same thing we do this a little dynamically to find the secret folder first then get all the secrets from it. Here's the breakdown of API calls we do just to display the secrets for one server:
First API call: Get token/authenticate. (always takes between 300ms-800ms to respond, that is so slow!)
Second API call: Get a list of folders within a specific base folder. Find the folder relating to the server we need the secrets for.
Third API call: Using that server's folder ID, get a list of all secret IDs in that folder (finds 10).
Fourth API call: Get the secret data for the first secret.
Fifth API call: Get the secret data for the second secret.
Sixth API call: Get the secret data for the third secret.
Seventh API call: Get the secret data for the fourth secret.
Eighth API call: Get the secret data for the fifth secret.
Ninth API call: Get the secret data for the sixth secret.
Tenth API call: Get the secret data for the seventh secret.
Eleventh API call: Get the secret data for the eighth secret.
Twelfth API call: Get the secret data for the ninth secret.
Thirteenth API call: Get the secret data for the tenth secret.
After the 13th API call we are then ready to display the data to the website. This sometimes takes over 20 seconds for the page to load. I watched firebug to see how long it takes just to get a token and it was over 300ms every time. Sure I can cache the token but the other 12 calls I can't. We use a lot of APIs on this same internal website (sharepoint, mediawiki, splunk, spectrum, etc) and none take this long to get data back from them. We noticed that this is the only one that uses SOAP to make the API calls. So we started thinking maybe SOAP is the slowpoke here?
1. Am I doing it wrong? Should it take 13 API calls to get 10 secrets to display?
2. Why does it take over 500ms per API call sometimes? These two systems are within the same rack in the datacenter and there's less than 1ms ping times between them.
7/1/2014 2:38:28 PM
Nick D wrote:
I'm going to toss in a +1 here. In my previous company as well as current company the slowness of the API is a common concern that hold us back from really taking advantage of anything realtime
We ended up throwing a Redis cache in front of it to make it useful. Multi-curl looks useful, but probably will wait for the REST API before rewriting it.