diff --git a/frameworks/Go/martini/README.md b/frameworks/Go/martini/README.md deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/frameworks/Go/martini/benchmark_config.json b/frameworks/Go/martini/benchmark_config.json deleted file mode 100644 index fbf0a94cfb8..00000000000 --- a/frameworks/Go/martini/benchmark_config.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "framework": "martini", - "tests": [ - { - "default": { - "json_url": "/bench/json", - "db_url": "/bench/single", - "query_url": "/bench/multiple?queries=", - "update_url": "/bench/update?queries=", - "plaintext_url": "/bench/plaintext", - "port": 8080, - "approach": "Realistic", - "classification": "Micro", - "database": "Postgres", - "framework": "martini", - "language": "Go", - "flavor": "None", - "orm": "Raw", - "platform": "None", - "webserver": "None", - "os": "Linux", - "database_os": "Linux", - "display_name": "martini", - "notes": "", - "versus": "go" - } - } - ] -} diff --git a/frameworks/Go/martini/config.toml b/frameworks/Go/martini/config.toml deleted file mode 100644 index 58b7fec1bc9..00000000000 --- a/frameworks/Go/martini/config.toml +++ /dev/null @@ -1,18 +0,0 @@ -[framework] -name = "martini" - -[main] -urls.plaintext = "/bench/plaintext" -urls.json = "/bench/json" -urls.db = "/bench/single" -urls.query = "/bench/multiple?queries=" -urls.update = "/bench/update?queries=" -approach = "Realistic" -classification = "Micro" -database = "Postgres" -database_os = "Linux" -os = "Linux" -orm = "Raw" -platform = "None" -webserver = "None" -versus = "go" diff --git a/frameworks/Go/martini/go.mod b/frameworks/Go/martini/go.mod deleted file mode 100644 index f5af950e26b..00000000000 --- a/frameworks/Go/martini/go.mod +++ /dev/null @@ -1,10 +0,0 @@ -module martini - -go 1.19 - -require ( - github.com/go-martini/martini v0.0.0-20170121215854-22fa46961aab - github.com/lib/pq v1.10.7 -) - -require github.com/codegangsta/inject v0.0.0-20150114235600-33e0aa1cb7c0 // indirect diff --git a/frameworks/Go/martini/go.sum b/frameworks/Go/martini/go.sum deleted file mode 100644 index 7f8410d7c13..00000000000 --- a/frameworks/Go/martini/go.sum +++ /dev/null @@ -1,6 +0,0 @@ -github.com/codegangsta/inject v0.0.0-20150114235600-33e0aa1cb7c0 h1:sDMmm+q/3+BukdIpxwO365v/Rbspp2Nt5XntgQRXq8Q= -github.com/codegangsta/inject v0.0.0-20150114235600-33e0aa1cb7c0/go.mod h1:4Zcjuz89kmFXt9morQgcfYZAYZ5n8WHjt81YYWIwtTM= -github.com/go-martini/martini v0.0.0-20170121215854-22fa46961aab h1:xveKWz2iaueeTaUgdetzel+U7exyigDYBryyVfV/rZk= -github.com/go-martini/martini v0.0.0-20170121215854-22fa46961aab/go.mod h1:/P9AEU963A2AYjv4d1V5eVL1CQbEJq6aCNHDDjibzu8= -github.com/lib/pq v1.10.7 h1:p7ZhMD+KsSRozJr34udlUrhboJwWAgCg34+/ZZNvZZw= -github.com/lib/pq v1.10.7/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= diff --git a/frameworks/Go/martini/main.go b/frameworks/Go/martini/main.go deleted file mode 100644 index 09e1a392f9e..00000000000 --- a/frameworks/Go/martini/main.go +++ /dev/null @@ -1,148 +0,0 @@ -package main - -import ( - "database/sql" - "encoding/json" - "log" - "net/http" - "time" - - "github.com/go-martini/martini" - _ "github.com/lib/pq" -) - -var ( - db *sql.DB - worldSelectPrepared *sql.Stmt - worldUpdatePrepared *sql.Stmt - fortuneSelectPrepared *sql.Stmt -) - -type World struct { - Id uint16 `json:"id"` - RandomNumber uint16 `json:"randomNumber"` -} - - -func main() { - initDB() - - m := martini.Classic() - - m.Use(setRequiredHeaders) - - m.Group("/bench", func (r martini.Router) { - r.Get("/plaintext", plaintextHandler) - r.Get("/json" , jsonHandler) - r.Get("/single" , singleQueryHandler) - r.Get("/multiple" , multipleQueriesHandler) - r.Get("/update" , updatesHandler) - }) - - m.RunOnAddr(":8080") -} - -// Initialize the connection to the database -func initDB() { - driverName := "postgres" - connectionString := "postgres://benchmarkdbuser:benchmarkdbpass@tfb-database/hello_world?sslmode=disable" - worldSelect := "SELECT id, randomNumber FROM World WHERE id = $1" - worldUpdate := "UPDATE World SET randomNumber = $1 WHERE id = $2" - fortuneSelect := "SELECT id, message FROM Fortune" - // worldRowCount := 10000 - maxConnections := 256 - - db, err := sql.Open(driverName, connectionString) - - if err != nil { - log.Fatalf("Error opening database: %v", err) - } - - db.SetMaxIdleConns(maxConnections) - db.SetMaxOpenConns(maxConnections) - - worldSelectPrepared, err = db.Prepare(worldSelect) - if err != nil { - log.Fatal(err) - } - worldUpdatePrepared, err = db.Prepare(worldUpdate) - if err != nil { - log.Fatal(err) - } - fortuneSelectPrepared, err = db.Prepare(fortuneSelect) - if err != nil { - log.Fatal(err) - } -} - -// Create middleware to add Server and Date headers to all -// routes. -func setRequiredHeaders(w http.ResponseWriter, r *http.Request) { - t := time.Now(); - - w.Header().Set("Server", "Martini") - w.Header().Set("Date", t.Format(time.RFC1123)) -} - -// Route handlers -func plaintextHandler() string { - return "Hello, World!" -} - -func jsonHandler(w http.ResponseWriter) []byte { - message := map[string]interface{}{"message": "Hello, World!"} - w.Header().Set("Content-Type", "application/json") - - res, _ := json.Marshal(message); - return res -} - -func singleQueryHandler(w http.ResponseWriter) { - var world World - - w.Header().Set("Content-Type", "application/json") - - err := worldSelectPrepared.QueryRow(RandomNumber()).Scan(&world.Id, &world.RandomNumber) - if err != nil { - log.Fatalf("Error scanning world row: %s", err.Error()) - } - - // No need to return anything as we are writing straight - // to the response itself - json.NewEncoder(w).Encode(&world) -} - -func multipleQueriesHandler(w http.ResponseWriter, r *http.Request) { - queries := SanitizeQueries(r) - worlds := make([]World, queries) - - w.Header().Set("Content-Type", "application/json") - - for i := 0; i < queries; i += 1 { - err := worldSelectPrepared.QueryRow(RandomNumber()).Scan(&worlds[i].Id, &worlds[i].RandomNumber) - - if err != nil { - log.Fatalf("Error scanning world row: %v", err) - } - } - - json.NewEncoder(w).Encode(worlds) -} - -func updatesHandler(w http.ResponseWriter, r *http.Request) { - queries := SanitizeQueries(r) - - worlds := make([]World, queries) - for i := 0; i < queries; i++ { - if err := worldSelectPrepared.QueryRow(RandomNumber()).Scan(&worlds[i].Id, &worlds[i].RandomNumber); err != nil { - log.Fatalf("Error scanning world row: %v", err) - } - worlds[i].RandomNumber = uint16(RandomNumber()) - if _, err := worldUpdatePrepared.Exec(worlds[i].RandomNumber, worlds[i].Id); err != nil { - log.Fatalf("Error updating world row: %v", err) - } - } - - w.Header().Set("Content-Type", "application/json") - json.NewEncoder(w).Encode(worlds) -} diff --git a/frameworks/Go/martini/martini.dockerfile b/frameworks/Go/martini/martini.dockerfile deleted file mode 100644 index e538810471f..00000000000 --- a/frameworks/Go/martini/martini.dockerfile +++ /dev/null @@ -1,10 +0,0 @@ -FROM docker.io/golang:1.19 - -WORKDIR /home -COPY . . - -RUN go mod download - -EXPOSE 8080 - -CMD GOAMD64=v3 go run . diff --git a/frameworks/Go/martini/randomNumber.go b/frameworks/Go/martini/randomNumber.go deleted file mode 100644 index 8231cc48859..00000000000 --- a/frameworks/Go/martini/randomNumber.go +++ /dev/null @@ -1,9 +0,0 @@ -package main - -import "math/rand" - -func RandomNumber() uint16 { - max := 10000 - - return uint16(rand.Intn(max) + 1) -} diff --git a/frameworks/Go/martini/sanitizeQueries.go b/frameworks/Go/martini/sanitizeQueries.go deleted file mode 100644 index cc51bc5a1e8..00000000000 --- a/frameworks/Go/martini/sanitizeQueries.go +++ /dev/null @@ -1,25 +0,0 @@ -package main - -import ( - "net/http" - "strconv" -) - -func SanitizeQueries(r *http.Request) int { - n := 1 - max := 500 - min := 1 - - if nStr := r.URL.Query().Get("queries"); len(nStr) > 0 { - n, _ = strconv.Atoi(nStr) - } - - - if n < min { - return min - } else if n > max { - return max - } - - return n -}