Speed up 20-second OpenID sign in via RPXNow

349 Views Asked by At

I've implemented RPXNow for several applications as a great abstraction for OpenID and OAuth to enable Google and Facebook sign-ins. My only complaint is that sign-in takes way too long. After clicking on Google's "Sign In" button, it takes 8-10 seconds for the whole process to finish, and this is from my local machine! I'm only querying https://rpxnow.com/api/v2/auth_info once for a response string from my AccountController, which includes the sign-in result and user profile.

So I opted to implement DotNetOpenAuth instead. Using Google as my provider, it still takes 7-9 seconds to complete sign in! It can't be my repository layer since a Forms login is instant. Hence, I must attribute the waiting period to the lag between my system, RPXNow and the authentication provider. The same delay takes place on my basic and premium RPXNow accounts.

Google OpenID login on StackOverflow always seems instant. How can I speed up my OpenID sign-ins? I'm willing to ditch RPXNow if I can bring sign in down to 1-3 seconds.


Edit: OK, so I went and timed how long my RPXNow request actually takes, and it's less than two seconds (1984ms and 2100ms from a cold start), but the entire process takes 7-8* seconds. Maybe it's the redirection or Google's sign-in box. I'll have to run some more diagnostics.

  • Warm start. RPXNow scripts, images and DNS were cached.

More testing: I'm testing this from a 384kbps ADSL connection, which is what most of the people here in SA still have. Here is the timing breakdown for signing in using Google:

Cold Start Breakdown:

  1. Load RPXNow widget: 3.1s
  2. Load pop-up window: 5.9s
  3. Click on Google provider: neglected
  4. Load Google sign-in box: 4.1s
  5. Submit Google details: neglected
  6. Wait for RPX to redirect: 7.7s (incl. 1.9s auth time)

Total sign-in time, excl. data entry:

20.8 seconds.

Too Long.

Warm Start Breakdown:

  1. Load RPXNow widget: 2.2s
  2. Sign-in via Google: 6.5s (incl. 1.8s auth time)

Total sign-in time, excl. data entry:

8.7 seconds.

Barely acceptable.

1

There are 1 best solutions below

0
On

To be honest, we need to see your code. Some general performance ideas:

Cache when you can, either in a user-specific Session or the HttpCache if it is an application level variable you are constantly recomputing. Avoid writing out files to disk. To be honest it sounds like you are running up against either

  1. Seriously uncool network latency
  2. A busy-wait condition where something is waiting to acquire a locked resource
  3. A very poor algorithm doing something bad
  4. Writing something to disk a lot

My best suggestion is that you step through your code and try to test it locally. Consider using Stopwatch in System.Diagnostic and logging out your loading times where you suspect the problem code is at. Isolate the problem. Sounds like your main performance problem has little to do with OAuth or RPX in my opinion.

To increase your page load time consider running the page through Google PageSpeed Insights and make sure you are minifying your JS and CSS whenever possible.