开发者

Why i am getting DeadlineExceededException: in my web application?

开发者 https://www.devze.com 2023-04-11 09:57 出处:网络
I am using google app engine. Before everything was working fine but now when i call a servlet, browser takes a lot of time and then shows this:

I am using google app engine. Before everything was working fine but now when i call a servlet, browser takes a lot of time and then shows this:

 DeleteBooksServlet: com.google.apphosting.api.DeadlineExceededException: This request (0000000000000000) started at 2011/10/08 10:58:13.573 UTC and was still executing at 2011/10/08 10:59:13.036 UTC.

In that servlet i have a query which takes all books from database and then delete them.

Before same servlet was working fine but now i am getting this. Why i am g开发者_如何学运维etting this thing now? Thanks in advance.


Because you certainly have so many books in the database that the query takes a lot of time (more than 1 minute), and that GAE throws this exception when a request is so long.

See http://code.google.com/intl/en-US/appengine/docs/java/runtime.html#Quotas_and_Limits


Deleting n books takes O(n) time. When that time passes the request limit, you need to make that operation faster.

A very good general technique is to break the deletes into batches, where a batch may delete, say, 100 books). Then use the task queue framework to schedule and run the batches. Some people take this further, and use the MapReduce framework to managing the batching.

0

精彩评论

暂无评论...
验证码 换一张
取 消