INNER CODE UNIT · Go
buildServer
kserve/kserve · cmd/agent/main.go:410
func buildServer(port string, userPort int, loggerArgs *loggerArgs, batcherArgs *batcherArgs,
probeContainer func() bool, logging *zap.SugaredLogger,
) (server *http.Server, drain func()) {
logging.Infof("Building server user port %d port %s", userPort, port)
target := &url.URL{
Scheme: "http",
Host: net.JoinHostPort("127.0.0.1", strconv.Itoa(userPort)),
}
maxIdleConns := 1000 // TODO: somewhat arbitrary value for CC=0, needs experimental validation.
httpProxy := httputil.NewSingleHostReverseProxy(target)
httpProxy.Transport = pkgnet.NewAutoTransport(maxIdleConns /* max-idle */, maxIdleConns /* max-idle-per-host */)
httpProxy.ErrorHandler = pkghandler.Error(logging)
httpProxy.BufferPool = proxy.NewBufferPool()
httpProxy.FlushInterval = proxy.FlushInterval
// Create handler chain.