Skip to main content

Multiple active sessions of API connection with external system


Sometimes, when an API connects with an external system, it cannot use same session and hence will be requesting new session (previous session will still be active) each time it connects with Salesforce. In such scenarios many questions arise as below. 

- What happens to previous sessions?
- Do they expire automatically after 120 minutes?
- At a given time, how many active sessions there can be?
- What are the implications of multiple open sessions at given point in time? 

Depending on how they are created, your session responds accordingly. For example, if you are using the SOAP API to call login () with the same credentials from a single device, you will likely get the same session Id back. Beware of calling logout () here, as you will end both (being the same session).

Expiry time will be controlled by the configuration. Default is 120 minutes after last activity, but this can be changed.

The limiting factor in terms of usage will be the Concurrent API Request Limit (https://help.salesforce.com/HTViewHelpDoc?id=integrate_api_rate_limiting.htm). E.g. With a developer edition org you can only have 5 active long running requests. There are other limits that will also come into play, such as the SOQL querylocator. See Execution Governors and Limits (https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_gov_limits.htm).

Best practice is you run a small trial to see how it behaves with your setup. You can monitor your active sessions with the User Session Information page. (https://help.salesforce.com/htviewhelpdoc?id=security_user_session_info.htm&siteLang=en_US)

Comments