Multiple Server Instances - How do they work?
I’m new to Google AppEngine and am trying to understand more about how
applications run distributed across multiple servers.
What I’m wondering is this. If I create a GO application, with a global
variable, such “Counter” in the code below. Each time a user hit’s the
page, the counter is shown and incremented. In all cases that I’ve tried,
this works fine, even with multiple users. Each user getting the next
counter. However, what if the google infrastructure starts spreading my
application to other servers. What happens then?
#1) Does each new server instance get a copy of the active memory space
(starting off from the last known Counter)? do they start at zero again?
#2) If multiple server instances are created, are they ever consolidated
again (who wins in a consolidated memory roundup?)
#3) When a user connects during a session (eh, whatever that is), is he
guaranteed to get the same server again? The same memory space again (if
moved to another server)?
Is this stuff documented somewhere?
Thanks in advance,
Randy
package main
import (
"http"
"fmt"
)
var Counter int
func init() {
http.HandleFunc("/", httpRootHandler)
}
func httpRootHandler(response http.ResponseWriter, request *http.Request) {
response.Header().Set("Content-Type", "text/plain; charset=utf-8")
fmt.Fprint(response, "Current counter is ", Counter)
Counter++
}
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-appengine/-/JxW2kx72hfUJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en.