function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
naveenkumarbvnaveenkumarbv 

Performance - How much time does it take to load Contact Entity into a Rails 3 application.

Hi All,

 

I'm newbie on working with rails 3 and integrating the same with salesforce too. So far, working on this task has been very interesting.

I wanted to know how much time does it take to load contact(or any other) entity from salesforce.

 

I am using Ruby1.9.2/Rails 3.x as my development environment, and not using any particular gem to work on salesforce.

 

I've used OAuth2 - UserName Password flow to connect to salesforce, where I get an access token, and using this access_token for all subsequent requests to work with salesforce.

 

Before accessing salesforce each time I'm checking if an access_token is available to query salesforce.

 

If an access_token is available fine, else query for an access_token again and perform the operation.

 

And below are the list of fields I'm trying to fetch from Contact Entity

Id, FirstName, MiddleName__c, LastName, Email, Gender__c, MailingStreet, MailingCity, MailingState, MailingPostalCode, MobilePhone, MailingCountry 

 

On an average it takes around 1 to 2 sec or sometimes more than 2 secs(rarely) to fetch the records and display on my web page. 

 

So, can anyone give me some clarification on what is the normal query time to fetch data from Salesforce. And how do we handle such performance issues??

 

Thanks in Advance.

 

Regards,

Naveen Kumar B.V 

 

 

 

SuperfellSuperfell

How many rows are you fetching? single row fetches should easily be within the 100ms range. What's the bandwidth/latency like between your server and salesforce?

naveenkumarbvnaveenkumarbv

Hi Simon,

 

Thanks for the reply. I am trying to fetch only a single record from Contact entity using a where condition based on email.

I have checked it with Force.com beta explorer also, it takes around 120ms to 160ms sometimes..

 

Please refer to the code below, and suggest any changes to be done to improve the performance:

 

def load_by_email! (email)
  puts "Loading details by email id........"
  result = nil
 @uri.get({:q => "SELECT Id, FirstName, MiddleName__c, LastName, Email, Gender__c, MailingStreet, MailingCity,       MailingState, MailingPostalCode, MobilePhone, MailingCountry FROM Contact WHERE Email = '#{email}'"}, headers) do |callback|
callback.on_ok do |response|
self.replace(response.deserialise['records'].map do |contact|
result = Contact.new(@salesforce_session,
'FirstName' => contact["FirstName"], 'MiddleName__c' => contact["MiddleName__c"],
'LastName' => contact["LastName"], 'Id' => contact["Id"],
'Email' => contact["Email"], 'Gender__c' => contact["Gender__c"],
'MailingStreet' => contact["MailingStreet"], 'MailingCity' => contact["MailingCity"],
'MailingState' => contact["MailingState"], 'MailingPostalCode' => contact["MailingPostalCode"],
'MobilePhone' => contact["MobilePhone"], 'MailingCountry' => contact["MailingCountry"]
)
end)
end

callback.on(400..406) do |response|
@errors = response.deserialise.first['message']
end
end
puts "---------------------------------------------------------"
puts result.inspect
return result
end

 

Regards,

Naveen Kumar B.V