The goapp tool
The Go App Engine SDK now includes the "goapp" tool, an App Engine-specific version of the "go" tool. The new name permits users to keep both the regular "go" tool and the "goapp" tool in their system PATH.
In addition to the existing "go" tool commands, the "goapp" tool provides new commands for working with App Engine apps. The "goapp serve" command starts the local development server and the "goapp deploy" command uploads an app to App Engine.
The "goapp serve" and "goapp deploy" commands give you a simpler user interface and consistency with existing commands like "go get" and "go fmt". For example, to run a local instance of the app in the current directory, run:
$ goapp serve
To upload it to App Engine:
$ goapp deploy
You can also specify the Go import path to serve or deploy:
$ goapp serve github.com/user/myapp
You can even specify a YAML file to serve or deploy a specific module:
$ goapp deploy mymodule.yaml
These commands should replace most uses of "dev_appserver.py" and "appcfg.py", although the Python tools are still available for their less common uses.
Local unit testing
The Go App Engine SDK now supports local unit testing, using Go's native testing package and the "go test" command (provided as "goapp test" by the SDK).
Furthermore, you can now write tests that use App Engine services. The aetest package provides an appengine.Context value that delegates requests to a temporary instance of the development server.
For more information about using "goapp test" and the aetest package see the Local Unit Testing for Go documentation. Note that the aetest package is still in its early days; we hope to add more features over the coming months.
Better concurrency support
It is now possible to configure the number of concurrent requests served by each of your app's dynamic instances by setting the max_concurrent_requests option (available to Automatic Scaling modules only).
Here's an example app.yaml file:
application: maxigopher
version: 1
runtime: go
api_version: go1
automatic_scaling:
max_concurrent_requests: 100
This configures each instance of the app to serve up to 100 requests concurrently (up from the default of 10). You can configure Go instances to serve up to a maximum of 500 concurrent requests.
This setting allows your instances to handle more simultaneous requests by taking advantage of Go's efficient handling of concurrency, which should yield better instance utilization and ultimately fewer billable instance hours.
With these changes Go on App Engine is more convenient and efficient than ever, and we hope you enjoy the improvements. Please join the google-appengine-go group to raise questions or discuss these changes with the engineering team and the rest of the community.
- Posted by Andrew Gerrand, Developer Programs Engineer
0 comments:
Post a Comment