github.com/graybobo/golang.org-package-offline-cache@v0.0.0-20200626051047-6608995c132f/x/blog/content/appengine-dec2013.article (about) 1 Go on App Engine: tools, tests, and concurrency 2 13 Dec 2013 3 Tags: appengine 4 5 Andrew Gerrand 6 7 Johan Euphrosine 8 9 * Background 10 11 When we [[http://blog.golang.org/go-and-google-app-engine][launched Go for App Engine]] 12 in May 2011 the SDK was just a modified version of the Python SDK. 13 At the time, there was no canonical way to build or organize Go programs, so it 14 made sense to take the Python approach. Since then Go 1.0 was released, 15 including the [[http://golang.org/cmd/go/][go tool]] and a 16 [[http://golang.org/doc/code.html][convention]] for organizing Go programs. 17 18 In January 2013 we announced 19 [[http://blog.golang.org/the-app-engine-sdk-and-workspaces-gopath][better integration]] 20 between the Go App Engine SDK and the go tool, promoting the use of 21 conventional import paths in App Engine apps and making it possible to use "go 22 get" to fetch app dependencies. 23 24 With the recent release of App Engine 1.8.8 we are pleased to announce more 25 improvements to the developer experience for Go on App Engine. 26 27 * The goapp tool 28 29 The Go App Engine SDK now includes the "goapp" tool, an App Engine-specific 30 version of the "go" tool. The new name permits users to keep both the regular 31 "go" tool and the "goapp" tool in their system PATH. 32 33 In addition to the existing "go" tool [[http://golang.org/cmd/go/][commands]], 34 the "goapp" tool provides new commands for working with App Engine apps. 35 The "[[https://developers.google.com/appengine/docs/go/tools/devserver][goapp serve]]" 36 command starts the local development server and the 37 "[[https://developers.google.com/appengine/docs/go/tools/uploadinganapp][goapp deploy]]" 38 command uploads an app to App Engine. 39 40 The main advantages offered by the "goapp serve" and "goapp deploy" commands 41 are a simplified user interface and consistency with existing commands like 42 "go get" and "go fmt". 43 For example, to run a local instance of the app in the current directory, run: 44 45 $ goapp serve 46 47 To upload it to App Engine: 48 49 $ goapp deploy 50 51 You can also specify the Go import path to serve or deploy: 52 53 $ goapp serve github.com/user/myapp 54 55 You can even specify a YAML file to serve or deploy a specific 56 [[https://developers.google.com/appengine/docs/go/modules/][module]]: 57 58 $ goapp deploy mymodule.yaml 59 60 These commands can replace most uses of `dev_appserver.py` and `appcfg.py`, 61 although the Python tools are still available for their less common uses. 62 63 * Local unit testing 64 65 The Go App Engine SDK now supports local unit testing, using Go's native 66 [[https://developers.google.com/appengine/docs/go/tools/localunittesting][testing package]] 67 and the "[[http://golang.org/cmd/go/#hdr-Test_packages][go test]]" command 68 (provided as "goapp test" by the SDK). 69 70 Furthermore, you can now write tests that use App Engine services. 71 The [[https://developers.google.com/appengine/docs/go/tools/localunittesting#Go_Introducing_the_aetest_package][aetest package]] 72 provides an appengine.Context value that delegates requests to a temporary 73 instance of the development server. 74 75 For more information about using "goapp test" and the aetest package, see the 76 [[https://developers.google.com/appengine/docs/go/tools/localunittesting][Local Unit Testing for Go documentation]]. 77 Note that the aetest package is still in its early days; 78 we hope to add more features over time. 79 80 * Better concurrency support 81 82 It is now possible to configure the number of concurrent requests served by 83 each of your app's dynamic instances by setting the 84 [[https://developers.google.com/appengine/docs/go/modules/#max_concurrent_requests][`max_concurrent_requests`]] option 85 (available to [[https://developers.google.com/appengine/docs/go/modules/#automatic_scaling][Automatic Scaling modules]] only). 86 87 Here's an example `app.yaml` file: 88 89 application: maxigopher 90 version: 1 91 runtime: go 92 api_version: go1 93 automatic_scaling: 94 max_concurrent_requests: 100 95 96 This configures each instance of the app to serve up to 100 requests 97 concurrently (up from the default of 10). You can configure Go instances to 98 serve up to a maximum of 500 concurrent requests. 99 100 This setting allows your instances to handle more simultaneous requests by 101 taking advantage of Go's efficient handling of concurrency, which should yield 102 better instance utilization and ultimately fewer billable instance hours. 103 104 * Conclusion 105 106 With these changes Go on App Engine is more convenient and efficient than ever, 107 and we hope you enjoy the improvements. Please join the 108 [[http://groups.google.com/group/google-appengine-go/][google-appengine-go group]] 109 to raise questions or discuss these changes with the engineering team and the 110 rest of the community.