App App quota depletion software mitigation

I am working on a gae application using python. The application includes a data collection system collected by the crowd, and the data used in the application is submitted by users across the country. Now I use the default quotas (free), but I ran into the problem of providing at least 99% of the time for my application.

The problem is that Google blocks further requests sent to your application when you run out of allocated quotas, and during a recent test take-off, one person was able to create an automatic posting script that quickly exhausted the CPU quota - after that the application will only serve HTTP 403 Forbidden status code for the request instead of calling a request handler . Now I have secured the system so as not to allow automatic postings, but how can I guarantee that user users will not cause such β€œdimming” during production?

I know the quota API, but I think that it can only give me profiling information for my application, I want to slow down the speed of requests (for example, per minute for quotas per minute) without serving error pages or power outages.

Any suggestions?

+4
source share
1 answer

One common solution to this problem is to delegate tasks with taskqueue speed limits.

For instance:

 queue: - name: mail-throttle rate: 2000/d bucket_size: 10 - name: background-processing-throttle rate: 5/s 

Thus, you can control the use of all parts of the application, forcing them to remain in the range of available quotas.

A few caveats:
1. Queues provide the best effort. FIFO Order
2. Completion / completion of a task is calculated by several quotas

+5
source

Source: https://habr.com/ru/post/1338817/


All Articles