[#130] Slow API?

Migrated from Redmine #130 | Author: Erik Joling
Status: New | Priority: Normal | Created: 2018-03-22


Hi,

I’m the developer of www.thegreatescape.info. On this website we have a custom integration of your Simplybook service. For example on: https://www.thegreatescape.info/reserveren/

But the last few days we have experienced slow responses while requesting availability-data from your servers and sometimes even timeouts. Could you check this? Is there anything out of the ordinary?

Kind regards,
Erik Joling

Redmine Admin wrote:

Please provide us raw http request which is slow now.

Erik Joling wrote:

What do you mean by a raw http request? How could I provide it?

And I have a couple of extra questions:

  • Is it possible to retrieve availability data of multiple units at once (with different event-ids). On https://www.thegreatescape.info/reserveren/ I’m currently calling getStartTimeMatrix multiple times to get all availability data.
  • Is there a restriction how many times to call your api?

Redmine Admin wrote:

Raw http request is the following thing HTTP/1.1: Request

  • It is possible to call getStartTimeMatrix in multiple threads at same time

  • Yes, we do have restrictions for common users. It depends on current server load, your site load and other factors. You will never reach this limits for small site. f you have thousands bookings per day then welcome to our enterprise version.

Erik Joling wrote:

  • It is possible to call getStartTimeMatrix in multiple threads at same time

How would I do that? Currently I connect to your servers via the json-rpc-client (php) multiple times.

  • Yes, we do have restrictions for common users. It depends on current server load, your site load and other factors. You will never reach this limits for small site. f you have thousands bookings per day then welcome to our enterprise version.

The application on https://www.thegreatescape.info/reserveren/ checks availability for 7 units on each change of date. When there are 50 people using it at the same time this results in 350 api calls each time. That couldn’t be the problem?

Redmine Admin wrote:

You can run you php script in multiple threads. Or use some other techniques to call our API in parallel.

350 calls at same time will be a problem. You need to cache results to not call same function twice if nothing was changed. There is API callback feature to subscribe to new bookings which may affect availability.

Erik Joling wrote:

You need to cache results to not call same function twice if nothing was changed. There is API callback feature to subscribe to new bookings which may affect availability.

I figured something like that would exist. Could you point me in the right direction?

Redmine Admin wrote:

there is callback our option in API plugin settings. Your script ill be notified when someone will make new booking. Then you will be able to do desire actions like cache updating for booking date or do something else.

Erik Joling wrote:

Thank you, I found it. Do you have documentation for how to use the callback? How can I access the booking-data which will be sent to the callback url?

Erik Joling wrote:

You can run you php script in multiple threads

How would I do that? Do you have any documentation on it?

There is API callback feature to subscribe to new bookings which may affect availability.

When multiple bookings are added/deleted/changed in one action it passes only the data of one booking it seems.

Erik Joling wrote:

You can run you php script in multiple threads. Or use some other techniques to call our API in parallel.

How can I wrap multiple calls in a single json-rpc request? Do you have any documentation on this?

Dmytro Bondarev wrote:

You can not wrap multiple calls in a single json-rpc request.
You can use multiple requests from your server. You can make calls in multiple threads.

Erik Joling wrote:

What would be the benefit of making calls in multiple threads?

Dmytro Bondarev wrote:

This approach will allow you to get more data in a shorter period of time.

Erik Joling wrote:

Ok, thanks. But it wouldn’t make a difference for the API limit, would it? The same amount of requests are being made to the Simplybook API I assume.

Dmytro Bondarev wrote:

Yes, it will not make a difference for the API limit.

Erik Joling wrote:

Ok, thank you for your help Dmitry