3 ms·
Here is my associated blog post: http://codeismightier.com/2008/10/web-app-version-of-domain-generator-up/ http://codeismightier.com/2008/10/web-app-version-of
by codeismightier 18y ago
Here is my associated blog post:
http://codeismightier.com/2008/10/web-app-version-of-domain-generator-up/ http://codeismightier.com/2008/10/web-app-version-of-domain-...
- kwamenum86 18y agoI would make the code more efficient. It is firing off an AJAX request after practically every keystroke. Each request took ~20 seconds. The page is also taking forever to load, probably because of all the requests being sent to the server. Why not just have people press enter to initiate retrieval of a result? That would improve user experience a ton. You should also queue AJAX request and only allow one or two at a time from the browser. That way, if you are really attached to this request after every keystroke feature the server can handle the load slightly better. Why do you need to make an AJAX call for a 1 character string? I typed in 't' and an AJAX request was fired off. That was 20 seconds ago and I am still waiting. It also appears that when the browser receives a result it runs several more AJAX calls recursively on all of the returned items. All of that should be done on the server. The overhead of all those HTTP requests is just too much, I would do the following to make this better: 1) Have a minimum query length for search 2) Don't do a request for every keystroke 3) Make an AJAX request queue 4) Do all of the recursion on the server, don't open a new HTTP requests for each recursive call I think this will be a lot better for server load and usability. Right now it is horribly inefficient. I have no use for it but would be pretty cool if I were looking for a domain name.
- wyclif 18y agoquery_too_long
- codeismightier 18y agoOk, I'll work on that right now.
- codeismightier 18y agoOk, now the user has to press enter for a request to be initiated. The reason that the script issues a recursive call is that I want the user to see the suggestions right away and check the status later since the DNS requests can take a while.
- kwamenum86 18y agoAre you caching the results on your server? You should cache the results for a better response time. That way you can return more information to the browser without checking availability for the same queries over and over. For example, save the availability of picklenickel.com for 24 hours (or maybe more I don't know). Then you can do some recursive calls using cached data. Making all those concurrent HTTP requests seems impractical and has to be affecting your server's responsiveness.
- codeismightier 18y agoI am running a local resolver (bind9), so I would assume that it is being cached.
- kwamenum86 18y agoHmm. It's strange the initial requests usually take 20+ s but the subsequent recursive requests take ~200 ms each. Maybe a bottleneck in the code?
- ojbyrne 18y agoI can't actually see the site yet, so I'm totally guessing, but a better way to do ajax autocomplete type things is to use SetTimeout or SetInterval to poll, rather than onKeyDown.