English 中文(简体)
如果申请在谷歌应用发动机上打上超过10英勇的URL Fetch,会发生什么?
原标题:What happens if an application calls more than 10 asynchronous URL Fetch on Google App Engine?

http://code.google.com/appengine/docs/python/urlfetch/overview.html“rel=“noreferer”> 注

The app can have up to 10 simultaneous asynchronous URL Fetch calls

What happens if an application calls more than 10 async fetch at a time?
Does Google App Engine raise an exception or simply queue the remain calls waiting to serve them?

最佳回答

乌姆,Swizzec是不正确的。 便于测试:

rpc = []
for i in range(1,20):
    rpc.append(urlfetch.createrpc())
    urlfetch.make_fetch_call(rpc[-1],"http://stackoverflow.com/questions/3639855/what-happens-if-i-call-more-than-10-asynchronous-url-fetch")

for r in rpc:
    response = r.get_result().status_code

这并不包括任何例外。 事实上,这项工作只是罚款! 请注意,对于不可破灭的申请,你的结果可能有所不同。

所报告的情况是一个不同的问题,与麻管局申请的最大同时联系有关。 对于有价证券,这里没有实际限制,它只是泛泛泛(服从1,000万条规则)。

公认会计原则没有办法知道你的请求书记员会发出阻挡URL fetch的令状,因此,他看到的500条联系与他实际做些什么无关(如果你的平均要求答复时间已经过去,这种透视性比照;1000米你可能增加500条)。

问题回答

这是一个老的问题,但我认为,可接受的答案是不正确的,或已经过时,可能混淆人们。 这是我实际测试的几个月,但从我的经验来看,德国教育总会不敢问,而是失败了最不寻常的URL fetches,超出每申请10个同时申请的限制。

见https://developers.google.com/appengine/docs/python/urlfetch/#Python_Making_requests>https://developers.google.com/appengine/docs/python/urlfetch/#Python_Making_requests

David Underhill has come up with a URL Fetch Manager for, which queues asynchronous URL fetches that over the limit in application Code.

我已经对贾瓦实施类似的要求,这些要求(由于缺乏备用功能或可清单的未来)一再被搁置:

/**
 * A URLFetchService wrapper that ensures that only 10 simultaneous asynchronous fetch requests are scheduled. If the
 * limit is reached, the fetchAsync operations will block until another request completes.
 */
public class BlockingURLFetchService implements URLFetchService {
    private final static int MAX_SIMULTANEOUS_ASYNC_REQUESTS = 10;

    private final URLFetchService urlFetchService = URLFetchServiceFactory.getURLFetchService();
    private final Queue<Future<HTTPResponse>> activeFetches = new LinkedList<>();

    @Override
    public HTTPResponse fetch(URL url) throws IOException {
        return urlFetchService.fetch(url);
    }

    @Override
    public HTTPResponse fetch(HTTPRequest request) throws IOException {
        return urlFetchService.fetch(request);
    }

    @Override
    public Future<HTTPResponse> fetchAsync(URL url) {
        block();

        Future<HTTPResponse> future = urlFetchService.fetchAsync(url);
        activeFetches.add(future);
        return future;
    }

    @Override
    public Future<HTTPResponse> fetchAsync(HTTPRequest request) {
        block();

        Future<HTTPResponse> future = urlFetchService.fetchAsync(request);
        activeFetches.add(future);
        return future;
    }

    private void block() {
        while (activeFetches.size() >= MAX_SIMULTANEOUS_ASYNC_REQUESTS) {
            // Max. simultaneous async requests reached; wait for one to complete
            Iterator<Future<HTTPResponse>> it = activeFetches.iterator();
            while (it.hasNext()) {
                if (it.next().isDone()) {
                    it.remove();
                    break;
                }
            }
        }
    }
}

500起错误开始发生。 沉默。

只有在你根据所有要求查看你的记录时,你才会发现这些错误(登机被列为错误)。 它只是说,“由于你达到了你同时提出的要求限制,请求遭到否决”。

因此,当你重新发出大量不寻常的电话时,确保你能够处理其中的一些空话。

回答问题:





相关问题
How to make logging.debug work on Appengine?

I m having a tough time getting the logging on Appengine working. the statement import logging is flagged as an unrecognized import in my PyDev Appengine project. I suspected that this was just an ...

gqlQuery returns object, want list of keys

Is there a way to convert the GqlQuery object to an array of keys, or is there a way to force the query to return an array of keys? For example: items = db.GqlQuery("SELECT __key__ FROM Items") ...

Integrating Google AppEngine with a Thick Client

I want to make a multi-user client-server solution with Java Swing thick client as a front-end and Google AppEngine (Java one) as a back-end. The problem is that GAE provides only web-based forms for ...

sorl.thumbnail : thumbnail is not a valid tag library?

I am trying to install sorl.thumbnail but am getting the following error message: thumbnail is not a valid tag library: Could not load template library from django.templatetags.thumbnail, No module ...

热门标签