VMware {code} Community
markkennedy
Contributor
Contributor

Staying logged in through java apis

Hi,

I have created a list of various java functions which I will use as wrappers around various common tasks in our cloud. We will run these tasks from both command line, and later from the web so if we can use this one implementation in java that would be great. The java functions login before they run using command line arguments as username / password / organization, and finally exit so we repeat this multiple times to achieve various combinations of actions.

The problem is, the login part of the java code seems to take at least 3-4 seconds so can we get around this somehow by doing something similar to what can be done with php, ie get some sort of authentication / session / id after one login, and reuse that multiple times?

Otherwise I guess the question is what can be done to improve login times as our vCloud server / db arn't overly stressed. Changing from FQHN to IP Address in the login call doesn't seem to help. If we can get login down to less than 1 second, we won't have to worry about keeping a session / authentication id etc.

Regards,

Mark

0 Kudos
3 Replies
cfor
Expert
Expert

One of the lessons learned when working with a custom portal was to stop logging in so much - it logs - created audit_event - and take a while (vs other operations) - our cloud was handling 200+ login's a minute - a ton of extra load.

To do this we had to create our processes (in .NET they pool connections).

One possible option (based on the functions you need to perform) would be to use REST API directly, this would make the session id (the login) your responsibility.  You could save that id, and use it again and again.  It should be valid for 30 minutes from the last time it was used.

ChrisF (VCP4, VCP5, VCP-Cloud) - If you find this or any other answer useful please consider awarding points by marking the answer correct or helpful
0 Kudos
rkamal
VMware Employee
VMware Employee

Next version of the Java SDK will contain a method for reusing the already existing session/cookie id.

I think this will be useful instead fo relogging again and again.

Regards,

Rajesh Kamal.

markkennedy
Contributor
Contributor

Thanks Rajesh,

Would you have any idea of the ETA of the newer SDK version. Is it weeks / months?

Regards,

Mark

0 Kudos