Using geocoder on production server

跟風遠走 提交于 2019-11-29 10:22:25

问题


I am developing a location based application. And i need a trustable source for getting geolocation.

right now i am using this geocoder plugin.

and i am getting this error:-

Geocoding API not responding fast enough (see Geocoder::Configuration.timeout to set limit).

I am getting error when our team of 5 is testing on staging servers

I need a fast enough solution with some ~10k request a day with no per second limits

PS: I am open to use some paid service.

EDIT

Think of a case you want to search something in NewYork. In textbox you will type newyork and press enter. Now on server side I need to fetch geocode for newyork and then search in db based upon that.


回答1:


You should geocode client side (in javascript) you won't be hit by the limits :

Server-side geocoding, through the Geocoding Web Service has a quota of 2,500 requests per IP per day, so all requests in one day count against the quota. In addition, the Web Service is rate-limited, so that requests that come in too quickly result in blocking. Client-side geocoding through the browser is rate limited per map session, so the geocoding is distributed across all your users and scales with your userbase. Geocoding quotas and rate limits drive the strategies outlined in this article.

When to Use Client-Side Geocoding

The basic answer is "almost always". As geocoding limits are per IP address, that limit counts against the consumer of your application. It's going to be very rare that someone is going to enter more than 2,500 addresses a day sitting at their computer. Therefore, running client-side geocoding, you generally don't have to worry about your quota.

http://code.google.com/apis/maps/articles/geocodestrat.html




回答2:


This is probably bound to happen with any web based service. You might want to consider sending these tasks to a background job manager (such as Resque or Delayed Job) which will retry failed jobs without disrupting users. They also make your application seem faster since your user will not have to wait for third party (and possibly intermittent) web applications to respond.




回答3:


Try using maxmind.com - this will do a geo lookup based on IP address. They have a free or paid for database that your store on your server. They have a Ruby API. I use this in a production system and the lookups are typically sub-millisecond as the data is cached.



来源:https://stackoverflow.com/questions/6451099/using-geocoder-on-production-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!