Reputation: 6671
I am starting dev_appserver.py with the following parameters:
dev_appserver.py --require_indexes=yes --datastore_path=/Users/mattfaus/dev/webapp/datastore/current.sqlite --blobstore_path=/Users/mattfaus/dev/webapp/datastore/blobs/ --host=0.0.0.0 --port=8080 --skip_sdk_update_check=yes --enable_sendmail=yes /Users/mattfaus/dev/webapp
And in Activity Monitor I see that it is constantly using 150% CPU even when it is not servicing requests. The biggest symptom I see is drastically reduce battery life and a nearly overheating CPU on my Macbook Pro. I now have to be careful to shutdown the appserver any time I am not using it to prevent these things from happening.
This started happening about 1 month ago, probably when I upgraded to 1.8.1 or 1.8.2. Is there any way I can configure GAE to stop using so much CPU?
I am using GAE SDK 1.8.3 and here is an overview of my hardware/software.
Hardware Overview:
Model Name: MacBook Pro Model Identifier: MacBookPro9,1 Processor Name: Intel Core i7 Processor Speed: 2.3 GHz Number of Processors: 1 Total Number of Cores: 4 L2 Cache (per Core): 256 KB L3 Cache: 6 MB Memory: 16 GB Sudden Motion Sensor: State: Enabled
System Software Overview:
System Version: OS X 10.8.4 (12E55) Kernel Version: Darwin 12.4.0 Boot Volume: Macintosh HD Boot Mode: Normal Computer Name: mattfaus User Name: Matt Faus (mattfaus) Secure Virtual Memory: Enabled
Upvotes: 5
Views: 468
Reputation: 193
The heavy cpu load you are observing on osx
is caused by the file watcher that dev_appserver
uses to monitor changes and restart instances automatically.
As you have noticed, using the parameter --automatic_restart=no
solves the issue but it's not great while developing.
One solution is to replace the file watcher, for example using this one (specifically meant to address the issue) : https://github.com/nilleb/fsevents-watcher
See this article for more context information : https://medium.com/lumapps-engineering/appengine-on-macos-is-a-cpu-hog-heres-how-to-solve-this-problem-with-another-python-native-9f2a6dc5c960
Upvotes: 1