OverReader – slow API queries

I got the API code working and in place. Works great on my local machine. Takes about 20 seconds to query 100 books (and I cache those results in the local DB for a month so subsequent searches of the same book at the same library will be fast). But… when I deployed it to my server at overreader.com, it’s really SLOW. Takes 2-4 minutes to do the queries. (but if you immediately do the same search again, it’s all local data so it takes ~2 seconds) I’m going to put in some more debug timing in it to see if I can figure out where the slowdown is on the server. I haven’t multithreaded it, that could help but I want to understand why it’s so slow when deployed before I multithread.

I’m half tempted to just do a weekly (or monthly) query of their entire DB for every library and just store that locally then all user queries would just be local queries and super fast. Not sure if Overdrive would appreciate me grabbing their entire DB though.

Maybe the timing info will help me figure out where the slowdown is though. I’m using linode.com as my host and it says I have “125 Mbit Network Out” but maybe that’s too slow? I wouldn’t think so.

On the bright side, it now queries for the book in both ebook and audiobook format and shows icons and links to each type.

Advertisements