Is Google App Engine Good?

On habr did not find much criticism on GAE, more and more positive reviews (for example here and here ). Therefore, I want to diversify the situation a bit, describing some critical nuances that interfere with the full work in the cloud.

I use GAE for a relatively short time, about six months. Until recently, these were simple sites with static content. GAE is ideal for them - low traffic that does not exhaust free quotas + java. Any html / javascript web application is uploaded quickly and conveniently with the help of a maven. You write mvn gae: deploy and in a minute your application is already in the cloud.

It is time to use the database a little more actively for a new project, and here the rake began. Since the application automatically scales, it becomes necessary to synchronize data between instances. For these purposes, a database is often used plus caching in the application or in an external tool (memcache). However, with this approach, free quotas for DataStore operations end very quickly. Currently, this is a total of 50,000 writes and as many reads per day. Of course, if necessary, quotas can be bought up. The following is the cost of DataStore quotas.

0.10 $ 100,000 write operations
0.07 $ 100,000 read operations
$ 0.01 100,000 small operations


Unfortunately, if you need to put 1 record in a table with two indexes, then the number of write operations is not 1, but 6. Updating 1 record will use 9 write operations. To make it more clear, I give a table on the expenditure of operations when working with the database.

High-level operation Low-Level Operations Required
Read 1 entry
(Entity Get)
1 read
Add 1 entry
(New Entity Put)
2 writes + 2 writes per indexed property value + 1 write per composite index value
Update 1 record
(Existing Entity Put)
1 write + 4 writes per modified indexed property value + 2 writes per modified composide index value
Delete 1 record
(Entity Delete)
2 writes + 2 writes per indexed property value + 1 write per composite index value
Request multiple records
(Query)
1 read + 1 small per entity retrieved
Request keys only
(Query, keys only)
1 read + 1 small per key retrieved
Creating a key
(Key allocation)
1 small


Thus, it turns out that even taking into account optimization and caching in memcache, on average about 30 datastore operations are spent per user request. In other words, there are only enough free quotas for ~ 1600 user queries. We add work with the database on cron tasks to user queries - it becomes really hard.

The situation is further aggravated by the fact that there are no unique keys in the DataStore, and when scaling up the system, you have to check the uniqueness of records manually before or after adding data to the database. Although this is commonplace for scalable systems, it additionally increases the load on the database, whose quotas are already expensive.

While dealing with restrictions in GAE, I found a curious blog article Carlos Ble - Goodbye Google App Engine and a similar section on the GAE Cupboard . To the known limitations, several more were immediately added, to which I had not yet reached. I must say right away that some of the described problems in GAE have already been fixed, but their considerable share has remained:
  1. The request cannot be completed for more than 30 seconds. It is especially critical for maintenance, for example with backups or upgrades.
  2. You cannot execute a query of the form DELETE FROM tableA WHERE conditionB. All records are deleted piece by piece and it costs a lot of money.
  3. The database does not support queries of the "LIKE" type - denormalization of the database and pagination are necessary.
  4. Cannot join tables.
  5. The base is very slow.
  6. The behavior of the database in the local environment is different from the behavior in the cloud.
  7. Intermittent crashes in DataStore and MemCache. For MemCache, this is not scary, but losing data in the database is critical. Backup is also difficult - backup of 50,000 records runs out of free quotas for the DataStore per day, plus a 30-second limit on the operation. Give Google $ 100 for backup of your base? Yes Easy!


Total:
  • GAE is ideal for personal pages or business card sites (free and reliable hosting).
  • If you need a database at least a little, the cost of hosting increases from free to $ 50 / month or more.
  • If you have a large number of static pages, it is better to use regular VPS with nginx.


While the code is not strongly tied to GAE, I turn to Linode. Then I will tell you what and how.
image