Find your content:

Search form

You are here

Overcoming Database.com latency

 
Share

I am working on a rather complex application hosted on Heroku and pulling data from Database.com. Because of the way SOQL works, I usually make a number of calls where I would traditionally have made one with a pile of joins. Because there is a reasonably large delay between the call and the response, this can result in heavy penalties.

So far I have moved the queries out of loops, mapping by Id which has lead to some improvements but even without looping, there are still quite a few calls. What can I do to improve response time?


Attribution to: Bob Roberts

Possible Suggestion/Solution #1

Two generic things that come to mind are caching and asynchronous operations.

For caching, you have three options, depending on the scale and complexity of your app:

  1. In session
  2. At the application level
  3. A caching server

Option 1 works well if the data is user-specific while the second two work well for global data. This will partially be determined by how long the data is valid and how long you can reasonably display stale information.

For asynchronous operations you need to make sure the calls to database.com are not blocking the main thread. This would allow you to start displaying data while the calls complete.


Attribution to: Mike Chale

Possible Suggestion/Solution #2

Round trips will kill you, so you want to do as much as possible in a single round trip, one thing you could do is encapsulate your multiple queries into a single operation using a custom web service (either soap or rest, depending on whats supported better in your client), this would get you down to 1 distributed API call, which would help a lot.


Attribution to: superfell

Possible Suggestion/Solution #3

For cloudspokes, we followed Superfell's approach of custom REST services on DB.com. It's not only good for efficiency, but the loose coupling makes it easy to consume the same services from mobile clients.


Attribution to: Rob Cheng
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/332

My Block Status

My Block Content