简体   繁体   中英

Update Loop In Google App Engine

I'm writing a simple mobile game where the server needs to update the state of games at a frequent and regular interval (eg update all active games every second).

I'm trying to implement the servers using Google App Engine but the most obvious ways to do this seem to have fatal flaws:

Cron: This would be ideal but it has a maximum resolution of 1 minute which is too long for my purposes. TaskQueue: This might work but it doesn't seem to guarantee when (or even if) tasks are run.

Is there a way to use Google App Engine to reliably achieve what I'm looking for or should I look elsewhere?

You can have a manual scaling instance that is running constantly, and will issue the 'tick' every second.

Overall though, your design and App Engine are a poor fit for each other. It'll still be difficult to guarantee that all your tick operations are processed within that 1 second. If you're using the datastore you'll need to be extra careful to make sure eventual consistency doesn't bite you.

You need to look at appengine backends, not task queues. They run longer thou you still need to have something that restarts it when it auto shuts down. Else look at a google compute instance which you can keep up forever.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM