Socket Sharding

This option allows linear scaling server performance on multi-CPU servers. See https://www.nginx.com/blog/socket-sharding-nginx-release-1-9-1/ for details. Enable with iris.WithSocketSharding configurator.

Example Code:

  1. package main
  2. import (
  3. "time"
  4. "github.com/kataras/iris/v12"
  5. )
  6. func main() {
  7. startup := time.Now()
  8. app := iris.New()
  9. app.Get("/", func(ctx iris.Context) {
  10. s := startup.Format(ctx.Application().ConfigurationReadOnly().GetTimeFormat())
  11. ctx.Writef("This server started at: %s\n", s)
  12. })
  13. app.Listen(":8080", iris.WithSocketSharding)
  14. // or app.Run(..., iris.WithSocketSharding)
  15. }