Browse Source

[go/evio] Remove Evio (#9777)

Evio hasn't been updated in 3 years.
The last commit removed the FUNDING.yml
https://github.com/tidwall/evio

It also only supports the plaintext test, which is no longer allowed.
Petrik de Heus 4 months ago
parent
commit
b6cb97b3fe

+ 0 - 9
frameworks/Go/evio/README.md

@@ -1,9 +0,0 @@
-# [evio](https://github.com/tidwall/evio) (GoLang) Benchmarking Test
-
-This is the go portion of a [benchmarking test suite](https://www.techempower.com/benchmarks/) comparing a variety of web development platforms.
-
-"Golang Evio"
-
-## Test URLs
-
-    http://localhost:8080/plaintext

+ 0 - 41
frameworks/Go/evio/benchmark_config.json

@@ -1,41 +0,0 @@
-{
-  "framework": "evio",
-  "tests": [{
-    "default": {
-      "plaintext_url": "/plaintext",
-      "port": 8080,
-      "approach": "Realistic",
-      "classification": "Platform",
-      "database": "None",
-      "framework": "evio",
-      "language": "Go",
-      "flavor": "None",
-      "orm": "Raw",
-      "platform": "None",
-      "webserver": "None",
-      "os": "Linux",
-      "database_os": "Linux",
-      "display_name": "Evio",
-      "notes": "",
-      "versus": "go"
-    },
-    "stdlib": {
-      "plaintext_url": "/plaintext",
-      "port": 8080,
-      "approach": "Realistic",
-      "classification": "Platform",
-      "database": "None",
-      "framework": "evio",
-      "language": "Go",
-      "flavor": "None",
-      "orm": "Raw",
-      "platform": "None",
-      "webserver": "None",
-      "os": "Linux",
-      "database_os": "Linux",
-      "display_name": "Evio",
-      "notes": "",
-      "versus": "go"
-    }
-  }]
-}

+ 0 - 26
frameworks/Go/evio/config.toml

@@ -1,26 +0,0 @@
-[framework]
-name = "evio"
-
-[main]
-urls.plaintext = "/plaintext"
-approach = "Realistic"
-classification = "Platform"
-database = "None"
-database_os = "Linux"
-os = "Linux"
-orm = "Raw"
-platform = "None"
-webserver = "None"
-versus = "go"
-
-[stdlib]
-urls.plaintext = "/plaintext"
-approach = "Realistic"
-classification = "Platform"
-database = "None"
-database_os = "Linux"
-os = "Linux"
-orm = "Raw"
-platform = "None"
-webserver = "None"
-versus = "go"

+ 0 - 11
frameworks/Go/evio/evio-stdlib.dockerfile

@@ -1,11 +0,0 @@
-FROM docker.io/golang:1.19
-
-WORKDIR /evio
-
-COPY ./src /evio
-
-RUN GOAMD64=v3 go build -ldflags="-s -w" -o app .
-
-EXPOSE 8080
-
-CMD ./app -stdlib

+ 0 - 11
frameworks/Go/evio/evio.dockerfile

@@ -1,11 +0,0 @@
-FROM docker.io/golang:1.19
-
-WORKDIR /evio
-
-COPY ./src /evio
-
-RUN GOAMD64=v3 go build -ldflags="-s -w" -o app .
-
-EXPOSE 8080
-
-CMD ./app

+ 0 - 7
frameworks/Go/evio/src/go.mod

@@ -1,7 +0,0 @@
-module evio/app
-
-go 1.19
-
-require github.com/tidwall/evio v1.0.8
-
-require github.com/kavu/go_reuseport v1.5.0 // indirect

+ 0 - 4
frameworks/Go/evio/src/go.sum

@@ -1,4 +0,0 @@
-github.com/kavu/go_reuseport v1.5.0 h1:UNuiY2OblcqAtVDE8Gsg1kZz8zbBWg907sP1ceBV+bk=
-github.com/kavu/go_reuseport v1.5.0/go.mod h1:CG8Ee7ceMFSMnx/xr25Vm0qXaj2Z4i5PWoUx+JZ5/CU=
-github.com/tidwall/evio v1.0.8 h1:+M7lh83rL4KwEObDGtXP3J1wE5utH80LeaAhrKCGVfE=
-github.com/tidwall/evio v1.0.8/go.mod h1:MJhRp4iVVqx/n/5mJk77oKmSABVhC7yYykcJiKaFYYw=

+ 0 - 225
frameworks/Go/evio/src/main.go

@@ -1,225 +0,0 @@
-// Copyright 2017 Joshua J Baker. All rights reserved.
-// Use of this source code is governed by an MIT-style
-// license that can be found in the LICENSE file.
-
-package main
-
-import (
-	"flag"
-	"fmt"
-	"log"
-	"strconv"
-	"strings"
-	"time"
-
-	"github.com/tidwall/evio"
-)
-
-var res string
-
-type request struct {
-	proto, method string
-	path, query   string
-	head, body    string
-	remoteAddr    string
-}
-
-func main() {
-	var port int
-	var loops int
-	var unixsocket string
-	var stdlib bool
-
-	flag.StringVar(&unixsocket, "unixsocket", "", "unix socket")
-	flag.IntVar(&port, "port", 8080, "server port")
-	flag.BoolVar(&stdlib, "stdlib", false, "use stdlib")
-	flag.IntVar(&loops, "loops", -1, "num loops")
-	flag.Parse()
-
-	res = "Hello, World!"
-
-	var events evio.Events
-	events.NumLoops = loops
-
-	events.Serving = func(srv evio.Server) (action evio.Action) {
-		log.Printf("http server started on port %d (loops: %d)", port, srv.NumLoops)
-		if unixsocket != "" {
-			log.Printf("http server started at %s", unixsocket)
-		}
-		if stdlib {
-			log.Printf("http server is using stdlib")
-		}
-		return
-	}
-
-	events.Opened = func(c evio.Conn) (out []byte, opts evio.Options, action evio.Action) {
-		c.SetContext(&evio.InputStream{})
-		return
-	}
-
-	events.Closed = func(c evio.Conn, err error) (action evio.Action) {
-		return
-	}
-
-	events.Data = func(c evio.Conn, in []byte) (out []byte, action evio.Action) {
-		if in == nil {
-			return
-		}
-		is := c.Context().(*evio.InputStream)
-		data := is.Begin(in)
-
-		// buf := bufio.NewReader(bytes.NewReader(data))
-		// req, err := http.ReadRequest(buf)
-		// if err != nil {
-		// 	log.Println(err)
-		// 	is.End(data)
-		// 	return
-		// }
-		// t := &http.Response{
-		// 	Status:        "200 OK",
-		// 	StatusCode:    200,
-		// 	Proto:         "HTTP/1.1",
-		// 	ProtoMajor:    1,
-		// 	ProtoMinor:    1,
-		// 	Body:          ioutil.NopCloser(bytes.NewBufferString(res)),
-		// 	ContentLength: int64(len(res)),
-		// 	Request:       req,
-		// 	Header:        make(http.Header, 0),
-		// }
-		// resp := bytes.NewBuffer(nil)
-		// t.Write(resp)
-		// out = resp.Bytes()
-
-		// process the pipeline
-		var req request
-		for {
-			leftover, err := parsereq(data, &req)
-			if err != nil {
-				// bad thing happened
-				out = appendresp(out, "500 Error", "", err.Error()+"\n")
-				action = evio.Close
-				break
-			} else if len(leftover) == len(data) {
-				// request not ready, yet
-				break
-			}
-			// handle the request
-			req.remoteAddr = c.RemoteAddr().String()
-			out = appendhandle(out, &req)
-			data = leftover
-		}
-		is.End(data)
-		return
-	}
-	var ssuf string
-	if stdlib {
-		ssuf = "-net"
-	}
-	// We at least want the single http address.
-	addrs := []string{fmt.Sprintf("tcp"+ssuf+"://:%d", port)}
-	if unixsocket != "" {
-		addrs = append(addrs, fmt.Sprintf("unix"+ssuf+"://%s", unixsocket))
-	}
-	// Start serving!
-	log.Fatal(evio.Serve(events, addrs...))
-}
-
-// appendhandle handles the incoming request and appends the response to
-// the provided bytes, which is then returned to the caller.
-func appendhandle(b []byte, req *request) []byte {
-	return appendresp(b, "200 OK", "", res)
-}
-
-// appendresp will append a valid http response to the provide bytes.
-// The status param should be the code plus text such as "200 OK".
-// The head parameter should be a series of lines ending with "\r\n" or empty.
-func appendresp(b []byte, status, head, body string) []byte {
-	b = append(b, "HTTP/1.1"...)
-	b = append(b, ' ')
-	b = append(b, status...)
-	b = append(b, '\r', '\n')
-	b = append(b, "Server: evio\r\n"...)
-	b = append(b, "Content-Type: text/plain\r\n"...)
-	b = append(b, "Date: "...)
-	b = time.Now().AppendFormat(b, "Mon, 02 Jan 2006 15:04:05 GMT")
-	b = append(b, '\r', '\n')
-	if len(body) > 0 {
-		b = append(b, "Content-Length: "...)
-		b = strconv.AppendInt(b, int64(len(body)), 10)
-		b = append(b, '\r', '\n')
-	}
-	b = append(b, head...)
-	b = append(b, '\r', '\n')
-	if len(body) > 0 {
-		b = append(b, body...)
-	}
-	return b
-}
-
-// parsereq is a very simple http request parser. This operation
-// waits for the entire payload to be buffered before returning a
-// valid request.
-func parsereq(data []byte, req *request) (leftover []byte, err error) {
-	sdata := string(data)
-	var i, s int
-	var top string
-	var clen int
-	var q = -1
-	// method, path, proto line
-	for ; i < len(sdata); i++ {
-		if sdata[i] == ' ' {
-			req.method = sdata[s:i]
-			for i, s = i+1, i+1; i < len(sdata); i++ {
-				if sdata[i] == '?' && q == -1 {
-					q = i - s
-				} else if sdata[i] == ' ' {
-					if q != -1 {
-						req.path = sdata[s:q]
-						req.query = req.path[q+1 : i]
-					} else {
-						req.path = sdata[s:i]
-					}
-					for i, s = i+1, i+1; i < len(sdata); i++ {
-						if sdata[i] == '\n' && sdata[i-1] == '\r' {
-							req.proto = sdata[s:i]
-							i, s = i+1, i+1
-							break
-						}
-					}
-					break
-				}
-			}
-			break
-		}
-	}
-	if req.proto == "" {
-		return data, fmt.Errorf("malformed request")
-	}
-	top = sdata[:s]
-	for ; i < len(sdata); i++ {
-		if i > 1 && sdata[i] == '\n' && sdata[i-1] == '\r' {
-			line := sdata[s : i-1]
-			s = i + 1
-			if line == "" {
-				req.head = sdata[len(top)+2 : i+1]
-				i++
-				if clen > 0 {
-					if len(sdata[i:]) < clen {
-						break
-					}
-					req.body = sdata[i : i+clen]
-					i += clen
-				}
-				return data[i:], nil
-			}
-			if strings.HasPrefix(line, "Content-Length:") {
-				n, err := strconv.ParseInt(strings.TrimSpace(line[len("Content-Length:"):]), 10, 64)
-				if err == nil {
-					clen = int(n)
-				}
-			}
-		}
-	}
-	// not enough data
-	return data, nil
-}