•  


Go on App Engine: tools, tests, and concurrency - The Go Programming Language

The Go Blog

Go on App Engine: tools, tests, and concurrency

Andrew Gerrand and Johan Euphrosine
13 December 2013

Background

When we launched?Go for App Engine in May 2011 the SDK was just a modified version of the Python SDK. At the time, there was no canonical way to build or organize Go programs, so it made sense to take the Python approach. Since then Go 1.0 was released, including the go tool ?and a convention ?for organizing Go programs.

In January 2013 we announced better integration between the Go App Engine SDK and the go tool, promoting the use of conventional import paths in App Engine apps and making it possible to use “go get” to fetch app dependencies.

With the recent release of App Engine 1.8.8 we are pleased to announce more improvements to the developer experience for Go on App Engine.

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 main advantages offered by the “goapp serve” and “goapp deploy” commands are a simplified 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 can 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 time.

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.

Conclusion

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.

Next article: Go talks at FOSDEM 2014
Previous article: Inside the Go Playground
Blog Index

- "漢字路" 한글한자자동변환 서비스는 교육부 고전문헌국역지원사업의 지원으로 구축되었습니다.
- "漢字路" 한글한자자동변환 서비스는 전통문화연구회 "울산대학교한국어처리연구실 옥철영(IT융합전공)교수팀"에서 개발한 한글한자자동변환기를 바탕하여 지속적으로 공동 연구 개발하고 있는 서비스입니다.
- 현재 고유명사(인명, 지명등)을 비롯한 여러 변환오류가 있으며 이를 해결하고자 많은 연구 개발을 진행하고자 하고 있습니다. 이를 인지하시고 다른 곳에서 인용시 한자 변환 결과를 한번 더 검토하시고 사용해 주시기 바랍니다.
- 변환오류 및 건의,문의사항은 juntong@juntong.or.kr로 메일로 보내주시면 감사하겠습니다. .
Copyright ⓒ 2020 By '전통문화연구회(傳統文化硏究會)' All Rights reserved.
 한국   대만   중국   일본