cgs / evernote

A Ruby client for Evernote
MIT License
144 stars 20 forks source link

Authentication takes a long time. Can we do something about it? #14

Closed rubiojr closed 13 years ago

rubiojr commented 13 years ago

I've tested it from different locations (worldwide) to discard connection issues.

[SPAIN]

rubiojr@blueleaf:~/tmp/foo$ time ruby test.rb warning: peer certificate won't be verified in this SSL session warning: peer certificate won't be verified in this SSL session warning: peer certificate won't be verified in this SSL session

real 0m6.199s user 0m0.372s sys 0m0.083s

[USA]

[rubiojr@bh01 ~]$ time ruby test.rb warning: peer certificate won't be verified in this SSL session warning: peer certificate won't be verified in this SSL session warning: peer certificate won't be verified in this SSL session

real 0m2.776s user 0m0.236s sys 0m0.078s

where test.rb is:

user_store_url = "https://sandbox.evernote.com/edam/user"
user_store = Evernote::UserStore.new(user_store_url, YAML.load_file('/home/rubiojr/.evernote-test.yml'))
auth_result = user_store.authenticate

Is this an Evernote (API servers or whatever) issue?

rubiojr commented 13 years ago

I've contacted Evernote service support about this. They pointed me to the official ruby library and I've been researching a little bit the "issue". Pasting what I've found and sent to Evernote support staff:

"I've been doing some more testing using the offcial SDK. Numbers are basically the same.

The "problem" is that the Github client lib is automatically validating the EDAM version so every auth request translates to 3 HTTPS requests (kind of chatty).

Average request time is between 1 and 1.5 secs so auth takes ~4 secs under good network conditions (at least in Spain).

Not sure if it's a server latency issue or a thrift issue or any other stuff though...

I'm developing an Evernote powered CLI Todo tool and it's kind of frustrating to wait 3/4 secs every time you add a new task with the tool.

Anything I can do to improve this situation?

Thanks! "

cgs commented 13 years ago

Interesting, that does suck that it's that slow. If I'm reading your response correctly, it sounds like there is really no difference between using the plain thrift code (without this gem) and the gem. Is that right? If that is the case, maybe you can figure out a way to only authenticate once using your tool.

rubiojr commented 13 years ago

Yeah, that's right. HTTPS requests to API server take around 1.5 secs/req. Evernote support told me that's pretty much ok, since their client uses background ops to perform requests it's not a big issue for them.

I'm writing a CLI Evernote powered tool so realtime is kind of important for mi. I'll need to write some kind of catching proxy/daemon for the task...