From 00416748fb572cfc20acba63d762d5565b315bae Mon Sep 17 00:00:00 2001 From: Petrik Date: Thu, 13 Mar 2025 09:16:59 +0100 Subject: [PATCH 01/39] [ruby/roda-sequel] Enable assume_fixed_locals +------------------------+-------+ | branch_name|fortune| +------------------------+-------+ | master| 29296| |roda/assume-fixed-locals| 32861| +------------------------+-------+ --- frameworks/Ruby/roda-sequel/Gemfile.lock | 6 +++--- frameworks/Ruby/roda-sequel/hello_world.rb | 10 +++++----- frameworks/Ruby/roda-sequel/views/fortunes.erb | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/frameworks/Ruby/roda-sequel/Gemfile.lock b/frameworks/Ruby/roda-sequel/Gemfile.lock index cb136ca6029..8c6f5bc8321 100644 --- a/frameworks/Ruby/roda-sequel/Gemfile.lock +++ b/frameworks/Ruby/roda-sequel/Gemfile.lock @@ -5,16 +5,16 @@ GEM bigdecimal (3.1.9) erubi (1.13.1) iodine (0.7.58) - json (2.10.1) + json (2.10.2) kgio (2.11.4) mysql2 (0.5.6) nio4r (2.7.4) pg (1.5.9) puma (6.6.0) nio4r (~> 2.0) - rack (3.1.11) + rack (3.1.12) raindrops (0.20.1) - roda (3.89.0) + roda (3.90.0) rack sequel (5.90.0) bigdecimal diff --git a/frameworks/Ruby/roda-sequel/hello_world.rb b/frameworks/Ruby/roda-sequel/hello_world.rb index 387e0187034..6f5adc59b5c 100644 --- a/frameworks/Ruby/roda-sequel/hello_world.rb +++ b/frameworks/Ruby/roda-sequel/hello_world.rb @@ -3,7 +3,7 @@ # Our Rack application to be executed by rackup class HelloWorld < Roda plugin :hooks - plugin :render, escape: true, layout_opts: { cache_key: "default_layout" } + plugin :render, escape: true, assume_fixed_locals: true, template_opts: { extract_fixed_locals: true}, layout_opts: { cache_key: "default_layout" } def bounded_queries queries = request.params["queries"].to_i @@ -56,13 +56,13 @@ def set_default_headers(response) # Test type 4: Fortunes r.is "fortunes" do response[CONTENT_TYPE] = HTML_TYPE - @fortunes = Fortune.all - @fortunes << Fortune.new( + fortunes = Fortune.all + fortunes << Fortune.new( id: 0, message: "Additional fortune added at request time." ) - @fortunes.sort_by!(&:message) - view :fortunes + fortunes.sort_by!(&:message) + view :fortunes, locals: { fortunes: fortunes } end # Test type 5: Database updates diff --git a/frameworks/Ruby/roda-sequel/views/fortunes.erb b/frameworks/Ruby/roda-sequel/views/fortunes.erb index e3dbcf66239..6b1f763da43 100644 --- a/frameworks/Ruby/roda-sequel/views/fortunes.erb +++ b/frameworks/Ruby/roda-sequel/views/fortunes.erb @@ -3,7 +3,7 @@ id message -<% @fortunes.each do |fortune| %> +<% fortunes.each do |fortune| %> <%= fortune.id %> <%= fortune.message %> From 85c756eaa03b7ef2ef9cf3881a39a3bd16baa178 Mon Sep 17 00:00:00 2001 From: Petrik Date: Fri, 14 Mar 2025 13:26:14 +0100 Subject: [PATCH 02/39] [ruby/roda-sequel] Get ids outside of database connection +----------------------------------+------+ | branch_name|update| +----------------------------------+------+ | master| 9258| |roda-sequel/ids-outside-connection| 9601| +----------------------------------+------+ --- frameworks/Ruby/roda-sequel/hello_world.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/frameworks/Ruby/roda-sequel/hello_world.rb b/frameworks/Ruby/roda-sequel/hello_world.rb index 387e0187034..a3da529b8d2 100644 --- a/frameworks/Ruby/roda-sequel/hello_world.rb +++ b/frameworks/Ruby/roda-sequel/hello_world.rb @@ -44,9 +44,10 @@ def set_default_headers(response) # Test type 3: Multiple database queries r.is "queries" do response[CONTENT_TYPE] = JSON_TYPE + ids = ALL_IDS.sample(bounded_queries) worlds = DB.synchronize do - ALL_IDS.sample(bounded_queries).map do |id| + ids.map do |id| World.with_pk(id).values end end @@ -69,9 +70,10 @@ def set_default_headers(response) r.is "updates" do response[CONTENT_TYPE] = JSON_TYPE worlds = [] + ids = ALL_IDS.sample(bounded_queries) DB.synchronize do worlds = - ALL_IDS.sample(bounded_queries).map do |id| + ids.map do |id| world = World.with_pk(id) new_value = rand1 new_value = rand1 while new_value == world.randomnumber From abdb3336e97b910a0070a96be238cbc3fc7b5952 Mon Sep 17 00:00:00 2001 From: kisesy <5843694+Kisesy@users.noreply.github.com> Date: Sat, 15 Mar 2025 00:30:34 +0800 Subject: [PATCH 03/39] [go/gin] Ensure rows are closed --- frameworks/Go/gin/gin-src/hello.go | 1 + frameworks/Go/gin/gin-std/main.go | 1 + 2 files changed, 2 insertions(+) diff --git a/frameworks/Go/gin/gin-src/hello.go b/frameworks/Go/gin/gin-src/hello.go index 88328c39e4b..4b15c438838 100644 --- a/frameworks/Go/gin/gin-src/hello.go +++ b/frameworks/Go/gin/gin-src/hello.go @@ -99,6 +99,7 @@ func fortunes(c *gin.Context) { c.AbortWithError(500, err) return } + defer rows.Close() // Ensure rows are closed fortunes := make(Fortunes, 0) for rows.Next() { //Fetch rows diff --git a/frameworks/Go/gin/gin-std/main.go b/frameworks/Go/gin/gin-std/main.go index 43065bc9b22..390d7e13f3b 100644 --- a/frameworks/Go/gin/gin-std/main.go +++ b/frameworks/Go/gin/gin-std/main.go @@ -99,6 +99,7 @@ func fortunes(c *gin.Context) { c.AbortWithError(500, err) return } + defer rows.Close() // Ensure rows are closed fortunes := make(Fortunes, 0) for rows.Next() { //Fetch rows From d0e486a4373421417a4ad2abb25285cbfbfe5564 Mon Sep 17 00:00:00 2001 From: Petrik Date: Fri, 14 Mar 2025 13:34:54 +0100 Subject: [PATCH 04/39] [ruby/sinatra] Get ids outside of database connection +------------------------------+------+ | branch_name|update| +------------------------------+------+ | master| 7905| |sinatra/ids-outside-connection| 8392| +------------------------------+------+ --- frameworks/Ruby/sinatra-sequel/hello_world.rb | 6 ++++-- frameworks/Ruby/sinatra/hello_world.rb | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/frameworks/Ruby/sinatra-sequel/hello_world.rb b/frameworks/Ruby/sinatra-sequel/hello_world.rb index 3f4380aecb5..f4410cd140c 100644 --- a/frameworks/Ruby/sinatra-sequel/hello_world.rb +++ b/frameworks/Ruby/sinatra-sequel/hello_world.rb @@ -54,9 +54,10 @@ def rand1 # Test type 3: Multiple database queries get '/queries' do + ids = ALL_IDS.sample(bounded_queries) worlds = DB.synchronize do - ALL_IDS.sample(bounded_queries).map do |id| + ids.map do |id| World.with_pk(id) end end @@ -79,9 +80,10 @@ def rand1 # Test type 5: Database updates get '/updates' do worlds = nil + ids = ALL_IDS.sample(bounded_queries) DB.synchronize do worlds = - ALL_IDS.sample(bounded_queries).map do |id| + ids.map do |id| world = World.with_pk(id) new_value = rand1 new_value = rand1 while new_value == world.randomnumber diff --git a/frameworks/Ruby/sinatra/hello_world.rb b/frameworks/Ruby/sinatra/hello_world.rb index 54afe906d6a..3c5a96ba2a4 100644 --- a/frameworks/Ruby/sinatra/hello_world.rb +++ b/frameworks/Ruby/sinatra/hello_world.rb @@ -59,9 +59,10 @@ def rand1 # Test type 3: Multiple database queries get '/queries' do + ids = ALL_IDS.sample(bounded_queries) worlds = ActiveRecord::Base.with_connection do - ALL_IDS.sample(bounded_queries).map do |id| + ids.map do |id| World.find(id).attributes end end @@ -86,8 +87,9 @@ def rand1 # Test type 5: Database updates get '/updates' do worlds = nil + ids = ALL_IDS.sample(bounded_queries) ActiveRecord::Base.with_connection do - worlds = ALL_IDS.sample(bounded_queries).map do |id| + worlds = ids.map do |id| world = World.find(id) new_value = rand1 new_value = rand1 until new_value != world.randomNumber From 5fa7af56113abea842dda2e82c344425e986a905 Mon Sep 17 00:00:00 2001 From: Petrik Date: Tue, 11 Mar 2025 10:06:30 +0100 Subject: [PATCH 05/39] [ruby/rack-sequel] Get ids outside of database connection +---------------------------+-----+ | branch_name|query| +---------------------------+-----+ | master|21337| |rack/ids-outside-connection|21873| +---------------------------+-----+ --- frameworks/Ruby/rack-sequel/hello_world.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/frameworks/Ruby/rack-sequel/hello_world.rb b/frameworks/Ruby/rack-sequel/hello_world.rb index 37674cba883..7e7c1beb144 100644 --- a/frameworks/Ruby/rack-sequel/hello_world.rb +++ b/frameworks/Ruby/rack-sequel/hello_world.rb @@ -44,8 +44,9 @@ def db end def queries(env) + ids = ALL_IDS.sample(bounded_queries(env)) DB.synchronize do - ALL_IDS.sample(bounded_queries(env)).map do |id| + ids.map do |id| World::BY_ID.(id: id) end end @@ -93,9 +94,10 @@ def fortunes end def updates(env) + ids = ALL_IDS.sample(bounded_queries(env)) DB.synchronize do worlds = - ALL_IDS.sample(bounded_queries(env)).map do |id| + ids.map do |id| world = World::BY_ID.(id: id) world[:randomnumber] = rand1 world From ee37ca41a63757318227a002cef39d8fbb6aea9b Mon Sep 17 00:00:00 2001 From: Petrik Date: Sun, 9 Mar 2025 18:46:43 +0100 Subject: [PATCH 06/39] [rails] Use ActionController::API for actions that return JSON API::Controller is a lightweight version of ActionController::Base, useful for controllers that only return JSON. +----------------------+------+-----+-----+------+-------+---------+--------------+ | branch_name| json| db|query|update|fortune|plaintext|weighted_score| +----------------------+------+-----+-----+------+-------+---------+--------------+ | master|147603|32970|26658| 15330| 18044| 173519| 1934| |rails/metal-controller|159296|33277|30173| 15743| 19999| 177191| 2059| +----------------------+------+-----+-----+------+-------+---------+--------------+ --- .../app/controllers/application_controller.rb | 9 --------- .../rails/app/controllers/concerns/date_header.rb | 15 +++++++++++++++ .../rails/app/controllers/fortunes_controller.rb | 12 ++++++++++++ .../app/controllers/hello_world_controller.rb | 11 +++-------- .../{hello_world => fortunes}/fortune.html.erb | 0 frameworks/Ruby/rails/config/routes.rb | 2 +- 6 files changed, 31 insertions(+), 18 deletions(-) create mode 100644 frameworks/Ruby/rails/app/controllers/concerns/date_header.rb create mode 100644 frameworks/Ruby/rails/app/controllers/fortunes_controller.rb rename frameworks/Ruby/rails/app/views/{hello_world => fortunes}/fortune.html.erb (100%) diff --git a/frameworks/Ruby/rails/app/controllers/application_controller.rb b/frameworks/Ruby/rails/app/controllers/application_controller.rb index 0ef204a6b6b..7944f9f993a 100644 --- a/frameworks/Ruby/rails/app/controllers/application_controller.rb +++ b/frameworks/Ruby/rails/app/controllers/application_controller.rb @@ -1,13 +1,4 @@ # frozen_string_literal: true class ApplicationController < ActionController::Base - if defined?(Agoo) || defined?(Falcon) || defined?(Puma) - before_action :add_date_header - end - - private - - def add_date_header - response.set_header('Date', Time.now.httpdate) - end end diff --git a/frameworks/Ruby/rails/app/controllers/concerns/date_header.rb b/frameworks/Ruby/rails/app/controllers/concerns/date_header.rb new file mode 100644 index 00000000000..d314038144c --- /dev/null +++ b/frameworks/Ruby/rails/app/controllers/concerns/date_header.rb @@ -0,0 +1,15 @@ +module DateHeader + extend ActiveSupport::Concern + + included do + if defined?(Agoo) || defined?(Falcon) || defined?(Puma) + before_action :add_header + end + end + + private + + def add_header + response.set_header('Date', Time.now.httpdate) + end +end diff --git a/frameworks/Ruby/rails/app/controllers/fortunes_controller.rb b/frameworks/Ruby/rails/app/controllers/fortunes_controller.rb new file mode 100644 index 00000000000..0f937aff039 --- /dev/null +++ b/frameworks/Ruby/rails/app/controllers/fortunes_controller.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +class FortunesController < ApplicationController + include DateHeader + + def index + @fortunes = Fortune.all.to_a + @fortunes << Fortune.new(id: 0, message: 'Additional fortune added at request time.') + @fortunes.sort_by!(&:message) + render :fortune + end +end diff --git a/frameworks/Ruby/rails/app/controllers/hello_world_controller.rb b/frameworks/Ruby/rails/app/controllers/hello_world_controller.rb index 9e9ce8b8327..d4582e18c02 100644 --- a/frameworks/Ruby/rails/app/controllers/hello_world_controller.rb +++ b/frameworks/Ruby/rails/app/controllers/hello_world_controller.rb @@ -1,6 +1,8 @@ # frozen_string_literal: true -class HelloWorldController < ApplicationController +class HelloWorldController < ActionController::API + include DateHeader + QUERY_RANGE = 1..10_000 # range of IDs in the Fortune DB ALL_IDS = QUERY_RANGE.to_a # enumeration of all the IDs in fortune DB MIN_QUERIES = 1 # min number of records that can be retrieved @@ -26,13 +28,6 @@ def cached_query render json: items.values end - def fortune - @fortunes = Fortune.all.to_a - @fortunes << Fortune.new(id: 0, message: 'Additional fortune added at request time.') - @fortunes.sort_by!(&:message) - render :fortune - end - def update worlds = ALL_IDS.sample(query_count).map do |id| world = World.find(id) diff --git a/frameworks/Ruby/rails/app/views/hello_world/fortune.html.erb b/frameworks/Ruby/rails/app/views/fortunes/fortune.html.erb similarity index 100% rename from frameworks/Ruby/rails/app/views/hello_world/fortune.html.erb rename to frameworks/Ruby/rails/app/views/fortunes/fortune.html.erb diff --git a/frameworks/Ruby/rails/config/routes.rb b/frameworks/Ruby/rails/config/routes.rb index 33afbfbcdda..22c47dc8704 100644 --- a/frameworks/Ruby/rails/config/routes.rb +++ b/frameworks/Ruby/rails/config/routes.rb @@ -46,7 +46,7 @@ get "json", to: JsonApp get "db", to: "hello_world#db" get "queries", to: "hello_world#query" - get "fortunes", to: "hello_world#fortune" + get "fortunes", to: "fortunes#index" get "updates", to: "hello_world#update" get "plaintext", to: PlaintextApp get "cached", to: "hello_world#cached_query" From 3a435f346e01b439d82021852b5323d66f866a1f Mon Sep 17 00:00:00 2001 From: David Denton Date: Sat, 15 Mar 2025 13:14:28 +0000 Subject: [PATCH 07/39] Reduce entries to limit of 10 --- .../Kotlin/http4k/benchmark_config.json | 220 ------------------ frameworks/Kotlin/http4k/config.toml | 176 -------------- frameworks/Kotlin/http4k/settings.gradle.kts | 12 +- 3 files changed, 2 insertions(+), 406 deletions(-) diff --git a/frameworks/Kotlin/http4k/benchmark_config.json b/frameworks/Kotlin/http4k/benchmark_config.json index 81dd97b4b47..810be318c33 100755 --- a/frameworks/Kotlin/http4k/benchmark_config.json +++ b/frameworks/Kotlin/http4k/benchmark_config.json @@ -2,51 +2,6 @@ "framework": "http4k", "tests": [ { - "default": { - "orm": "Raw", - "database_os": "Linux", - "cached_query_url": "/cached?queries=", - "db_url": "/db", - "json_url": "/json", - "fortune_url": "/fortunes", - "plaintext_url": "/plaintext", - "query_url": "/queries?queries=", - "update_url": "/updates?queries=", - "database": "Postgres", - "port": 9000, - "approach": "Realistic", - "classification": "Micro", - "framework": "http4k", - "language": "Kotlin", - "platform": "sunhttp", - "webserver": "None", - "os": "Linux", - "notes": "https://http4k.org", - "display_name": "http4k-sunhttp", - "versus": "servlet" - }, - "sunhttploom": { - "orm": "Raw", - "database_os": "Linux", - "cached_query_url": "/cached?queries=", - "db_url": "/db", - "json_url": "/json", - "fortune_url": "/fortunes", - "plaintext_url": "/plaintext", - "query_url": "/queries?queries=", - "database": "Postgres", - "port": 9000, - "approach": "Realistic", - "classification": "Micro", - "framework": "http4k", - "language": "Kotlin", - "platform": "sunhttp", - "webserver": "None", - "os": "Linux", - "notes": "https://http4k.org", - "display_name": "http4k-sunhttploom", - "versus": "servlet" - }, "apache": { "orm": "Raw", "database_os": "Linux", @@ -91,69 +46,6 @@ "notes": "https://http4k.org", "versus": "servlet" }, - "apache-graalvm": { - "orm": "Raw", - "database_os": "Linux", - "cached_query_url": "/cached?queries=", - "db_url": "/db", - "json_url": "/json", - "plaintext_url": "/plaintext", - "query_url": "/queries?queries=", - "update_url": "/updates?queries=", - "database": "Postgres", - "port": 9000, - "approach": "Realistic", - "classification": "Micro", - "framework": "http4k", - "language": "Kotlin", - "platform": "graalvm", - "webserver": "None", - "os": "Linux", - "notes": "https://http4k.org", - "versus": "servlet" - }, - "graalvm": { - "orm": "Raw", - "database_os": "Linux", - "cached_query_url": "/cached?queries=", - "db_url": "/db", - "json_url": "/json", - "plaintext_url": "/plaintext", - "query_url": "/queries?queries=", - "update_url": "/updates?queries=", - "database": "Postgres", - "port": 9000, - "approach": "Realistic", - "classification": "Micro", - "framework": "http4k", - "language": "Kotlin", - "platform": "graalvm", - "webserver": "None", - "os": "Linux", - "notes": "https://http4k.org", - "versus": "servlet" - }, - "helidon-graalvm": { - "orm": "Raw", - "database_os": "Linux", - "cached_query_url": "/cached?queries=", - "db_url": "/db", - "json_url": "/json", - "plaintext_url": "/plaintext", - "query_url": "/queries?queries=", - "update_url": "/updates?queries=", - "database": "Postgres", - "port": 9000, - "approach": "Realistic", - "classification": "Micro", - "framework": "http4k", - "language": "Kotlin", - "platform": "graalvm", - "webserver": "None", - "os": "Linux", - "notes": "https://http4k.org", - "versus": "helidon-jdbc" - }, "helidon-jdbc": { "orm": "Raw", "database_os": "Linux", @@ -242,118 +134,6 @@ "notes": "https://http4k.org", "versus": "jetty" }, - "jettyloom-pgclient": { - "orm": "Raw", - "database_os": "Linux", - "cached_query_url": "/cached?queries=", - "db_url": "/db", - "json_url": "/json", - "fortune_url": "/fortunes", - "plaintext_url": "/plaintext", - "query_url": "/queries?queries=", - "update_url": "/updates?queries=", - "database": "Postgres", - "port": 9000, - "approach": "Realistic", - "classification": "Micro", - "framework": "http4k", - "language": "Kotlin", - "platform": "jetty-loom-pgclient", - "webserver": "None", - "os": "Linux", - "notes": "https://http4k.org", - "versus": "jetty" - }, - "jetty11": { - "orm": "Raw", - "database_os": "Linux", - "cached_query_url": "/cached?queries=", - "db_url": "/db", - "json_url": "/json", - "fortune_url": "/fortunes", - "plaintext_url": "/plaintext", - "query_url": "/queries?queries=", - "update_url": "/updates?queries=", - "database": "Postgres", - "port": 9000, - "approach": "Realistic", - "classification": "Micro", - "framework": "http4k", - "language": "Kotlin", - "platform": "jetty11", - "webserver": "None", - "os": "Linux", - "notes": "https://http4k.org", - "versus": "jetty" - }, - "jetty11loom-jdbc": { - "orm": "Raw", - "database_os": "Linux", - "cached_query_url": "/cached?queries=", - "db_url": "/db", - "json_url": "/json", - "fortune_url": "/fortunes", - "plaintext_url": "/plaintext", - "query_url": "/queries?queries=", - "update_url": "/updates?queries=", - "database": "Postgres", - "port": 9000, - "approach": "Realistic", - "classification": "Micro", - "framework": "http4k", - "language": "Kotlin", - "platform": "jetty11-loom-jdbc", - "webserver": "None", - "os": "Linux", - "notes": "https://http4k.org", - "versus": "jetty11" - }, - "jetty11loom-pgclient": { - "orm": "Raw", - "database_os": "Linux", - "cached_query_url": "/cached?queries=", - "db_url": "/db", - "json_url": "/json", - "fortune_url": "/fortunes", - "plaintext_url": "/plaintext", - "query_url": "/queries?queries=", - "update_url": "/updates?queries=", - "database": "Postgres", - "port": 9000, - "approach": "Realistic", - "classification": "Micro", - "framework": "http4k", - "language": "Kotlin", - "platform": "jetty11-loom-pgclient", - "webserver": "None", - "os": "Linux", - "notes": "https://http4k.org", - "versus": "jetty11" - }, - "ktorcio": { - "orm": "Raw", - "database_os": "Linux", - "cached_query_url": "/cached?queries=", - "cached_query_url": "/cached?queries=", - "db_url": "/db", - "json_url": "/json", - "fortune_url": "/fortunes", - "plaintext_url": "/plaintext", - "query_url": "/queries?queries=", - "update_url": "/updates?queries=", - "database": "Postgres", - "port": 9000, - "approach": "Realistic", - "classification": "Micro", - "framework": "http4k", - "language": "Kotlin", - "platform": "ktor", - "webserver": "None", - "os": "Linux", - "notes": "https://http4k.org", - "versus": "ktor-cio", - "tags": ["broken"] - }, "ktornetty": { "orm": "Raw", "database_os": "Linux", diff --git a/frameworks/Kotlin/http4k/config.toml b/frameworks/Kotlin/http4k/config.toml index 4f3a6f6e614..e61586ecd1b 100644 --- a/frameworks/Kotlin/http4k/config.toml +++ b/frameworks/Kotlin/http4k/config.toml @@ -54,41 +54,6 @@ platform = "ktor" webserver = "None" versus = "ktor-netty" -[main] -urls.cached_query = "/cached?queries=" -urls.db = "/db" -urls.fortune = "/fortunes" -urls.json = "/json" -urls.plaintext = "/plaintext" -urls.query = "/queries?queries=" -urls.update = "/updates?queries=" -approach = "Realistic" -classification = "Micro" -database = "Postgres" -database_os = "Linux" -os = "Linux" -orm = "Raw" -platform = "sunhttp" -webserver = "None" -versus = "servlet" - -[sunhttploom] -urls.cached_query = "/cached?queries=" -urls.db = "/db" -urls.fortune = "/fortunes" -urls.json = "/json" -urls.plaintext = "/plaintext" -urls.query = "/queries?queries=" -approach = "Realistic" -classification = "Micro" -database = "Postgres" -database_os = "Linux" -os = "Linux" -orm = "Raw" -platform = "sunhttp" -webserver = "None" -versus = "servlet" - [apache4] urls.cached_query = "/cached?queries=" urls.db = "/db" @@ -143,78 +108,6 @@ platform = "jetty-loom-jdbc" webserver = "None" versus = "jetty" -[jettyloom-pgclient] -urls.cached_query = "/cached?queries=" -urls.db = "/db" -urls.fortune = "/fortunes" -urls.json = "/json" -urls.plaintext = "/plaintext" -urls.query = "/queries?queries=" -urls.update = "/updates?queries=" -approach = "Realistic" -classification = "Micro" -database = "Postgres" -database_os = "Linux" -os = "Linux" -orm = "Raw" -platform = "jetty-loom-pgclient" -webserver = "None" -versus = "jetty" - -[jetty11] -urls.cached_query = "/cached?queries=" -urls.db = "/db" -urls.fortune = "/fortunes" -urls.json = "/json" -urls.plaintext = "/plaintext" -urls.query = "/queries?queries=" -urls.update = "/updates?queries=" -approach = "Realistic" -classification = "Micro" -database = "Postgres" -database_os = "Linux" -os = "Linux" -orm = "Raw" -platform = "jetty11" -webserver = "None" -versus = "jetty" - -[jetty11loom-jdbc] -urls.cached_query = "/cached?queries=" -urls.db = "/db" -urls.fortune = "/fortunes" -urls.json = "/json" -urls.plaintext = "/plaintext" -urls.query = "/queries?queries=" -urls.update = "/updates?queries=" -approach = "Realistic" -classification = "Micro" -database = "Postgres" -database_os = "Linux" -os = "Linux" -orm = "Raw" -platform = "jetty-loom11-jdbc" -webserver = "None" -versus = "jetty11" - -[jetty11loom-pgclient] -urls.cached_query = "/cached?queries=" -urls.db = "/db" -urls.fortune = "/fortunes" -urls.json = "/json" -urls.plaintext = "/plaintext" -urls.query = "/queries?queries=" -urls.update = "/updates?queries=" -approach = "Realistic" -classification = "Micro" -database = "Postgres" -database_os = "Linux" -os = "Linux" -orm = "Raw" -platform = "jetty11-loom-pgclient" -webserver = "None" -versus = "jetty11" - [helidon-jdbc] urls.cached_query = "/cached?queries=" urls.db = "/db" @@ -269,75 +162,6 @@ platform = "apache-httpcore" webserver = "None" versus = "servlet" -[helidon-graalvm] -urls.cached_query = "/cached?queries=" -urls.db = "/db" -urls.json = "/json" -urls.plaintext = "/plaintext" -urls.query = "/queries?queries=" -urls.update = "/updates?queries=" -approach = "Realistic" -classification = "Micro" -database = "Postgres" -database_os = "Linux" -os = "Linux" -orm = "Raw" -platform = "graalvm" -webserver = "None" -versus = "helidon-jdbc" - -[apache-graalvm] -urls.cached_query = "/cached?queries=" -urls.db = "/db" -urls.json = "/json" -urls.plaintext = "/plaintext" -urls.query = "/queries?queries=" -urls.update = "/updates?queries=" -approach = "Realistic" -classification = "Micro" -database = "Postgres" -database_os = "Linux" -os = "Linux" -orm = "Raw" -platform = "graalvm" -webserver = "None" -versus = "servlet" - -[graalvm] -urls.cached_query = "/cached?queries=" -urls.db = "/db" -urls.json = "/json" -urls.plaintext = "/plaintext" -urls.query = "/queries?queries=" -urls.update = "/updates?queries=" -approach = "Realistic" -classification = "Micro" -database = "Postgres" -database_os = "Linux" -os = "Linux" -orm = "Raw" -platform = "graalvm" -webserver = "None" -versus = "servlet" - -[ktorcio] -urls.cached_query = "/cached?queries=" -urls.db = "/db" -urls.fortune = "/fortunes" -urls.json = "/json" -urls.plaintext = "/plaintext" -urls.query = "/queries?queries=" -urls.update = "/updates?queries=" -approach = "Realistic" -classification = "Micro" -database = "Postgres" -database_os = "Linux" -os = "Linux" -orm = "Raw" -platform = "ktor" -webserver = "None" -versus = "ktor-cio" - [ratpack] urls.cached_query = "/cached?queries=" urls.db = "/db" diff --git a/frameworks/Kotlin/http4k/settings.gradle.kts b/frameworks/Kotlin/http4k/settings.gradle.kts index bc46ef57f0e..d00bf33bbe8 100644 --- a/frameworks/Kotlin/http4k/settings.gradle.kts +++ b/frameworks/Kotlin/http4k/settings.gradle.kts @@ -23,23 +23,15 @@ rootProject.name = "http4k-benchmark" include("core") include("core-jdbc") include("core-pgclient") + + include("apache") -include("apache-graalvm") include("apache4") -include("graalvm") include("jetty") include("jettyloom-jdbc") -include("jettyloom-pgclient") -include("jetty11") -include("jetty11loom-jdbc") -include("jetty11loom-pgclient") include("helidon-jdbc") include("helidon-pgclient") -include("helidon-graalvm") -include("ktorcio") include("ktornetty") include("netty") include("ratpack") -include("sunhttp") -include("sunhttploom") include("undertow") From 80d798e3affe51449def416ae73eee17e7033f31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=A4=E9=9B=A8=E4=B8=9C?= <83822098+ltpp-universe@users.noreply.github.com> Date: Mon, 17 Mar 2025 23:52:05 +0800 Subject: [PATCH 08/39] Merge pull request #9677 from ltpp-universe/master Add fortunes & database updates & caching --- frameworks/Rust/hyperlane/.gitignore | 3 + frameworks/Rust/hyperlane/Cargo.lock | 1795 ----------------- frameworks/Rust/hyperlane/Cargo.toml | 10 +- frameworks/Rust/hyperlane/README.md | 18 +- .../Rust/hyperlane/benchmark_config.json | 7 +- frameworks/Rust/hyperlane/src/constant.rs | 11 +- frameworks/Rust/hyperlane/src/db.rs | 268 ++- frameworks/Rust/hyperlane/src/lazy.rs | 1 + frameworks/Rust/hyperlane/src/main.rs | 19 +- .../Rust/hyperlane/src/request_middleware.rs | 8 +- .../Rust/hyperlane/src/response_middleware.rs | 1 + frameworks/Rust/hyperlane/src/route.rs | 75 +- frameworks/Rust/hyperlane/src/server.rs | 10 +- frameworks/Rust/hyperlane/src/type.rs | 56 +- frameworks/Rust/hyperlane/src/utils.rs | 26 +- 15 files changed, 380 insertions(+), 1928 deletions(-) create mode 100644 frameworks/Rust/hyperlane/.gitignore delete mode 100644 frameworks/Rust/hyperlane/Cargo.lock diff --git a/frameworks/Rust/hyperlane/.gitignore b/frameworks/Rust/hyperlane/.gitignore new file mode 100644 index 00000000000..af8e65c2e7a --- /dev/null +++ b/frameworks/Rust/hyperlane/.gitignore @@ -0,0 +1,3 @@ +/target +/logs +Cargo.lock \ No newline at end of file diff --git a/frameworks/Rust/hyperlane/Cargo.lock b/frameworks/Rust/hyperlane/Cargo.lock deleted file mode 100644 index 8d66da54a3c..00000000000 --- a/frameworks/Rust/hyperlane/Cargo.lock +++ /dev/null @@ -1,1795 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 4 - -[[package]] -name = "addr2line" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" -dependencies = [ - "gimli", -] - -[[package]] -name = "adler2" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" - -[[package]] -name = "ahash" -version = "0.8.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" -dependencies = [ - "cfg-if", - "once_cell", - "version_check", - "zerocopy 0.7.35", -] - -[[package]] -name = "alloc-no-stdlib" -version = "2.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc7bb162ec39d46ab1ca8c77bf72e890535becd1751bb45f64c597edb4c8c6b3" - -[[package]] -name = "alloc-stdlib" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94fb8275041c72129eb51b7d0322c29b8387a0386127718b096429201a5d6ece" -dependencies = [ - "alloc-no-stdlib", -] - -[[package]] -name = "allocator-api2" -version = "0.2.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" - -[[package]] -name = "android-tzdata" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" - -[[package]] -name = "android_system_properties" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" -dependencies = [ - "libc", -] - -[[package]] -name = "async-func" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8882ceb09bc57f9b7a52d48cffab866310aeeb6a5aa1c9420640e7689660c9ee" -dependencies = [ - "tokio", -] - -[[package]] -name = "async-trait" -version = "0.1.87" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d556ec1359574147ec0c4fc5eb525f3f23263a592b1a9c07e0a75b427de55c97" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "autocfg" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" - -[[package]] -name = "backtrace" -version = "0.3.74" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" -dependencies = [ - "addr2line", - "cfg-if", - "libc", - "miniz_oxide", - "object", - "rustc-demangle", - "windows-targets", -] - -[[package]] -name = "base64" -version = "0.22.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" - -[[package]] -name = "bb8" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "212d8b8e1a22743d9241575c6ba822cf9c8fef34771c86ab7e477a4fbfd254e5" -dependencies = [ - "futures-util", - "parking_lot", - "tokio", -] - -[[package]] -name = "bb8-postgres" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e570e6557cd0f88d28d32afa76644873271a70dc22656df565b2021c4036aa9c" -dependencies = [ - "bb8", - "tokio", - "tokio-postgres", -] - -[[package]] -name = "bitflags" -version = "2.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd" - -[[package]] -name = "block-buffer" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" -dependencies = [ - "generic-array", -] - -[[package]] -name = "brotli" -version = "7.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc97b8f16f944bba54f0433f07e30be199b6dc2bd25937444bbad560bcea29bd" -dependencies = [ - "alloc-no-stdlib", - "alloc-stdlib", - "brotli-decompressor", -] - -[[package]] -name = "brotli-decompressor" -version = "4.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74fa05ad7d803d413eb8380983b092cbbaf9a85f151b871360e7b00cd7060b37" -dependencies = [ - "alloc-no-stdlib", - "alloc-stdlib", -] - -[[package]] -name = "bumpalo" -version = "3.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1628fb46dfa0b37568d12e5edd512553eccf6a22a78e8bde00bb4aed84d5bdbf" - -[[package]] -name = "byteorder" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" - -[[package]] -name = "bytes" -version = "1.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a" - -[[package]] -name = "cc" -version = "1.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be714c154be609ec7f5dad223a33bf1482fff90472de28f7362806e6d4832b8c" -dependencies = [ - "shlex", -] - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "chrono" -version = "0.4.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a7964611d71df112cb1730f2ee67324fcf4d0fc6606acbbe9bfe06df124637c" -dependencies = [ - "android-tzdata", - "iana-time-zone", - "js-sys", - "num-traits", - "wasm-bindgen", - "windows-link", -] - -[[package]] -name = "clonelicious" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c61986b9f0347d401ef41468e7aadba2ab6dfc2547df1862f2563250fbfa8d3" - -[[package]] -name = "color-output" -version = "6.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc537d9d2e7e15fa40da2a6a451afedea17808a63f8339863e3a6b5ae93db596" -dependencies = [ - "hyperlane-time", -] - -[[package]] -name = "core-foundation-sys" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" - -[[package]] -name = "cpufeatures" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" -dependencies = [ - "libc", -] - -[[package]] -name = "crc32fast" -version = "1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "crypto-common" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" -dependencies = [ - "generic-array", - "typenum", -] - -[[package]] -name = "digest" -version = "0.10.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" -dependencies = [ - "block-buffer", - "crypto-common", - "subtle", -] - -[[package]] -name = "displaydoc" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "fallible-iterator" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" - -[[package]] -name = "file-operation" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eaba2fa080e689c4ec9a0666c5b7eb074182fdba13a34e97b19b56ac2a855556" -dependencies = [ - "tokio", -] - -[[package]] -name = "flate2" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11faaf5a5236997af9848be0bef4db95824b1d534ebc64d0f0c6cf3e67bd38dc" -dependencies = [ - "crc32fast", - "miniz_oxide", -] - -[[package]] -name = "float-cmp" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b09cf3155332e944990140d967ff5eceb70df778b34f77d8075db46e4704e6d8" -dependencies = [ - "num-traits", -] - -[[package]] -name = "form_urlencoded" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" -dependencies = [ - "percent-encoding", -] - -[[package]] -name = "futures" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" -dependencies = [ - "futures-channel", - "futures-core", - "futures-executor", - "futures-io", - "futures-sink", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-channel" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" -dependencies = [ - "futures-core", - "futures-sink", -] - -[[package]] -name = "futures-core" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" - -[[package]] -name = "futures-executor" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" -dependencies = [ - "futures-core", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-io" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" - -[[package]] -name = "futures-macro" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "futures-sink" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" - -[[package]] -name = "futures-task" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" - -[[package]] -name = "futures-util" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" -dependencies = [ - "futures-channel", - "futures-core", - "futures-io", - "futures-macro", - "futures-sink", - "futures-task", - "memchr", - "pin-project-lite", - "pin-utils", - "slab", -] - -[[package]] -name = "generic-array" -version = "0.14.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" -dependencies = [ - "typenum", - "version_check", -] - -[[package]] -name = "getrandom" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" -dependencies = [ - "cfg-if", - "js-sys", - "libc", - "wasi 0.11.0+wasi-snapshot-preview1", - "wasm-bindgen", -] - -[[package]] -name = "getrandom" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43a49c392881ce6d5c3b8cb70f98717b7c07aabbdff06687b9030dbfbe2725f8" -dependencies = [ - "cfg-if", - "libc", - "wasi 0.13.3+wasi-0.2.2", - "windows-targets", -] - -[[package]] -name = "gimli" -version = "0.31.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" - -[[package]] -name = "halfbrown" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8588661a8607108a5ca69cab034063441a0413a0b041c13618a7dd348021ef6f" -dependencies = [ - "hashbrown", - "serde", -] - -[[package]] -name = "hashbrown" -version = "0.14.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" -dependencies = [ - "ahash", - "allocator-api2", -] - -[[package]] -name = "hex" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" - -[[package]] -name = "hmac" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" -dependencies = [ - "digest", -] - -[[package]] -name = "http-compress" -version = "2.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8646f4e10f8fc48d8f2a595e6ef303189e49e386d6863d771f028c969f0c5e42" -dependencies = [ - "brotli", - "flate2", - "http-constant", -] - -[[package]] -name = "http-constant" -version = "1.33.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a3567340a02df4ec03fa5475e2b273aa183d875b3bf09674403407aadda1cd1" - -[[package]] -name = "http-type" -version = "3.21.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4f21786d19bad67be1eb85b528e65722d44812d6e9bed878147f767573a2586" -dependencies = [ - "hex", - "http-compress", - "http-constant", - "lombok-macros", - "serde", - "serde-xml-rs", - "serde_json", - "serde_urlencoded", - "tokio", - "url", -] - -[[package]] -name = "hyperlane" -version = "4.31.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74319ece1df44e8ddd62a9e1ae13040ba34fd1500eb240fa449ca8fbc7210727" -dependencies = [ - "async-func", - "clonelicious", - "color-output", - "file-operation", - "futures", - "http-compress", - "http-type", - "hyperlane-log", - "lombok-macros", - "once_cell", - "recoverable-spawn", - "recoverable-thread-pool", - "serde", - "serde_json", - "server-manager", - "simd-json", - "std-macro-extensions", - "tokio", -] - -[[package]] -name = "hyperlane-log" -version = "1.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acf652414e2c385beb37c36341ae91f6eb686062f3cfff6c0cff8526deafbb65" -dependencies = [ - "file-operation", - "hyperlane-time", - "lombok-macros", - "once_cell", - "recoverable-spawn", -] - -[[package]] -name = "hyperlane-time" -version = "0.0.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11dcc4ca08d1ebfc1f70e7a40033483219f77909a7ef6c4af302a14aa97da3d2" - -[[package]] -name = "hyperlane_techempower" -version = "0.0.1" -dependencies = [ - "bb8", - "bb8-postgres", - "chrono", - "hyperlane", - "rand", - "serde", - "tokio-postgres", -] - -[[package]] -name = "iana-time-zone" -version = "0.1.61" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220" -dependencies = [ - "android_system_properties", - "core-foundation-sys", - "iana-time-zone-haiku", - "js-sys", - "wasm-bindgen", - "windows-core", -] - -[[package]] -name = "iana-time-zone-haiku" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" -dependencies = [ - "cc", -] - -[[package]] -name = "icu_collections" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db2fa452206ebee18c4b5c2274dbf1de17008e874b4dc4f0aea9d01ca79e4526" -dependencies = [ - "displaydoc", - "yoke", - "zerofrom", - "zerovec", -] - -[[package]] -name = "icu_locid" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637" -dependencies = [ - "displaydoc", - "litemap", - "tinystr", - "writeable", - "zerovec", -] - -[[package]] -name = "icu_locid_transform" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01d11ac35de8e40fdeda00d9e1e9d92525f3f9d887cdd7aa81d727596788b54e" -dependencies = [ - "displaydoc", - "icu_locid", - "icu_locid_transform_data", - "icu_provider", - "tinystr", - "zerovec", -] - -[[package]] -name = "icu_locid_transform_data" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdc8ff3388f852bede6b579ad4e978ab004f139284d7b28715f773507b946f6e" - -[[package]] -name = "icu_normalizer" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19ce3e0da2ec68599d193c93d088142efd7f9c5d6fc9b803774855747dc6a84f" -dependencies = [ - "displaydoc", - "icu_collections", - "icu_normalizer_data", - "icu_properties", - "icu_provider", - "smallvec", - "utf16_iter", - "utf8_iter", - "write16", - "zerovec", -] - -[[package]] -name = "icu_normalizer_data" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8cafbf7aa791e9b22bec55a167906f9e1215fd475cd22adfcf660e03e989516" - -[[package]] -name = "icu_properties" -version = "1.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93d6020766cfc6302c15dbbc9c8778c37e62c14427cb7f6e601d849e092aeef5" -dependencies = [ - "displaydoc", - "icu_collections", - "icu_locid_transform", - "icu_properties_data", - "icu_provider", - "tinystr", - "zerovec", -] - -[[package]] -name = "icu_properties_data" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67a8effbc3dd3e4ba1afa8ad918d5684b8868b3b26500753effea8d2eed19569" - -[[package]] -name = "icu_provider" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ed421c8a8ef78d3e2dbc98a973be2f3770cb42b606e3ab18d6237c4dfde68d9" -dependencies = [ - "displaydoc", - "icu_locid", - "icu_provider_macros", - "stable_deref_trait", - "tinystr", - "writeable", - "yoke", - "zerofrom", - "zerovec", -] - -[[package]] -name = "icu_provider_macros" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "idna" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e" -dependencies = [ - "idna_adapter", - "smallvec", - "utf8_iter", -] - -[[package]] -name = "idna_adapter" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "daca1df1c957320b2cf139ac61e7bd64fed304c5040df000a745aa1de3b4ef71" -dependencies = [ - "icu_normalizer", - "icu_properties", -] - -[[package]] -name = "itoa" -version = "1.0.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" - -[[package]] -name = "js-sys" -version = "0.3.77" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f" -dependencies = [ - "once_cell", - "wasm-bindgen", -] - -[[package]] -name = "libc" -version = "0.2.170" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "875b3680cb2f8f71bdcf9a30f38d48282f5d3c95cbf9b3fa57269bb5d5c06828" - -[[package]] -name = "litemap" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23fb14cb19457329c82206317a5663005a4d404783dc74f4252769b0d5f42856" - -[[package]] -name = "lock_api" -version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" -dependencies = [ - "autocfg", - "scopeguard", -] - -[[package]] -name = "log" -version = "0.4.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30bde2b3dc3671ae49d8e2e9f044c7c005836e7a023ee57cffa25ab82764bb9e" - -[[package]] -name = "lombok-macros" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebe4fc0110b8bdb29b2423a2be59fa7b9b3e0e1b225553514895564420887bc5" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "md-5" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf" -dependencies = [ - "cfg-if", - "digest", -] - -[[package]] -name = "memchr" -version = "2.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" - -[[package]] -name = "miniz_oxide" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e3e04debbb59698c15bacbb6d93584a8c0ca9cc3213cb423d31f760d8843ce5" -dependencies = [ - "adler2", -] - -[[package]] -name = "mio" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd" -dependencies = [ - "libc", - "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys", -] - -[[package]] -name = "num-traits" -version = "0.2.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" -dependencies = [ - "autocfg", -] - -[[package]] -name = "object" -version = "0.36.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87" -dependencies = [ - "memchr", -] - -[[package]] -name = "once_cell" -version = "1.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cde51589ab56b20a6f686b2c68f7a0bd6add753d697abf720d63f8db3ab7b1ad" - -[[package]] -name = "parking_lot" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" -dependencies = [ - "lock_api", - "parking_lot_core", -] - -[[package]] -name = "parking_lot_core" -version = "0.9.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" -dependencies = [ - "cfg-if", - "libc", - "redox_syscall", - "smallvec", - "windows-targets", -] - -[[package]] -name = "percent-encoding" -version = "2.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" - -[[package]] -name = "phf" -version = "0.11.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fd6780a80ae0c52cc120a26a1a42c1ae51b247a253e4e06113d23d2c2edd078" -dependencies = [ - "phf_shared", -] - -[[package]] -name = "phf_shared" -version = "0.11.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67eabc2ef2a60eb7faa00097bd1ffdb5bd28e62bf39990626a582201b7a754e5" -dependencies = [ - "siphasher", -] - -[[package]] -name = "pin-project-lite" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" - -[[package]] -name = "pin-utils" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" - -[[package]] -name = "postgres-protocol" -version = "0.6.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76ff0abab4a9b844b93ef7b81f1efc0a366062aaef2cd702c76256b5dc075c54" -dependencies = [ - "base64", - "byteorder", - "bytes", - "fallible-iterator", - "hmac", - "md-5", - "memchr", - "rand", - "sha2", - "stringprep", -] - -[[package]] -name = "postgres-types" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "613283563cd90e1dfc3518d548caee47e0e725455ed619881f5cf21f36de4b48" -dependencies = [ - "bytes", - "fallible-iterator", - "postgres-protocol", - "uuid", -] - -[[package]] -name = "ppv-lite86" -version = "0.2.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" -dependencies = [ - "zerocopy 0.8.23", -] - -[[package]] -name = "proc-macro2" -version = "1.0.94" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a31971752e70b8b2686d7e46ec17fb38dad4051d94024c88df49b667caea9c84" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "quote" -version = "1.0.39" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1f1914ce909e1658d9907913b4b91947430c7d9be598b15a1912935b8c04801" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "rand" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3779b94aeb87e8bd4e834cee3650289ee9e0d5677f976ecdb6d219e5f4f6cd94" -dependencies = [ - "rand_chacha", - "rand_core", - "zerocopy 0.8.23", -] - -[[package]] -name = "rand_chacha" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" -dependencies = [ - "ppv-lite86", - "rand_core", -] - -[[package]] -name = "rand_core" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" -dependencies = [ - "getrandom 0.3.1", -] - -[[package]] -name = "recoverable-spawn" -version = "3.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5081593fb6a36af3e9ca8c4f23735f9d454a252cba0629509baa3947983846d" -dependencies = [ - "once_cell", - "tokio", -] - -[[package]] -name = "recoverable-thread-pool" -version = "2.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4190261c8a4823ceaf4b9cd68bf28deca98aa5697d2e1ec66e8053dac2a817fa" -dependencies = [ - "lombok-macros", - "recoverable-spawn", -] - -[[package]] -name = "redox_syscall" -version = "0.5.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b8c0c260b63a8219631167be35e6a988e9554dbd323f8bd08439c8ed1302bd1" -dependencies = [ - "bitflags", -] - -[[package]] -name = "ref-cast" -version = "1.0.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a0ae411dbe946a674d89546582cea4ba2bb8defac896622d6496f14c23ba5cf" -dependencies = [ - "ref-cast-impl", -] - -[[package]] -name = "ref-cast-impl" -version = "1.0.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1165225c21bff1f3bbce98f5a1f889949bc902d3575308cc7b0de30b4f6d27c7" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "rustc-demangle" -version = "0.1.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" - -[[package]] -name = "rustversion" -version = "1.0.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eded382c5f5f786b989652c49544c4877d9f015cc22e145a5ea8ea66c2921cd2" - -[[package]] -name = "ryu" -version = "1.0.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" - -[[package]] -name = "scopeguard" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" - -[[package]] -name = "serde" -version = "1.0.219" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde-xml-rs" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb3aa78ecda1ebc9ec9847d5d3aba7d618823446a049ba2491940506da6e2782" -dependencies = [ - "log", - "serde", - "thiserror", - "xml-rs", -] - -[[package]] -name = "serde_derive" -version = "1.0.219" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "serde_json" -version = "1.0.140" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373" -dependencies = [ - "itoa", - "memchr", - "ryu", - "serde", -] - -[[package]] -name = "serde_urlencoded" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" -dependencies = [ - "form_urlencoded", - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "server-manager" -version = "3.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5144bc130554928fb304af2e7590742db173a40f82672613dc293f7567e8730e" -dependencies = [ - "tokio", -] - -[[package]] -name = "sha2" -version = "0.10.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest", -] - -[[package]] -name = "shlex" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" - -[[package]] -name = "signal-hook-registry" -version = "1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1" -dependencies = [ - "libc", -] - -[[package]] -name = "simd-json" -version = "0.14.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa2bcf6c6e164e81bc7a5d49fc6988b3d515d9e8c07457d7b74ffb9324b9cd40" -dependencies = [ - "getrandom 0.2.15", - "halfbrown", - "ref-cast", - "serde", - "serde_json", - "simdutf8", - "value-trait", -] - -[[package]] -name = "simdutf8" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e" - -[[package]] -name = "siphasher" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d" - -[[package]] -name = "slab" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" -dependencies = [ - "autocfg", -] - -[[package]] -name = "smallvec" -version = "1.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fcf8323ef1faaee30a44a340193b1ac6814fd9b7b4e88e9d4519a3e4abe1cfd" - -[[package]] -name = "socket2" -version = "0.5.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c970269d99b64e60ec3bd6ad27270092a5394c4e309314b18ae3fe575695fbe8" -dependencies = [ - "libc", - "windows-sys", -] - -[[package]] -name = "stable_deref_trait" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" - -[[package]] -name = "std-macro-extensions" -version = "0.21.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b44c771c1591df90e3b49f618362dc1c431a8df6a7a6cc69dbe00757b158522" - -[[package]] -name = "stringprep" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b4df3d392d81bd458a8a621b8bffbd2302a12ffe288a9d931670948749463b1" -dependencies = [ - "unicode-bidi", - "unicode-normalization", - "unicode-properties", -] - -[[package]] -name = "subtle" -version = "2.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" - -[[package]] -name = "syn" -version = "2.0.100" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b09a44accad81e1ba1cd74a32461ba89dee89095ba17b32f5d03683b1b1fc2a0" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "synstructure" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "thiserror" -version = "1.0.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "tinystr" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f" -dependencies = [ - "displaydoc", - "zerovec", -] - -[[package]] -name = "tinyvec" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09b3661f17e86524eccd4371ab0429194e0d7c008abb45f7a7495b1719463c71" -dependencies = [ - "tinyvec_macros", -] - -[[package]] -name = "tinyvec_macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" - -[[package]] -name = "tokio" -version = "1.44.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9975ea0f48b5aa3972bf2d888c238182458437cc2a19374b81b25cdf1023fb3a" -dependencies = [ - "backtrace", - "bytes", - "libc", - "mio", - "parking_lot", - "pin-project-lite", - "signal-hook-registry", - "socket2", - "tokio-macros", - "windows-sys", -] - -[[package]] -name = "tokio-macros" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "tokio-postgres" -version = "0.7.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c95d533c83082bb6490e0189acaa0bbeef9084e60471b696ca6988cd0541fb0" -dependencies = [ - "async-trait", - "byteorder", - "bytes", - "fallible-iterator", - "futures-channel", - "futures-util", - "log", - "parking_lot", - "percent-encoding", - "phf", - "pin-project-lite", - "postgres-protocol", - "postgres-types", - "rand", - "socket2", - "tokio", - "tokio-util", - "whoami", -] - -[[package]] -name = "tokio-util" -version = "0.7.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7fcaa8d55a2bdd6b83ace262b016eca0d79ee02818c5c1bcdf0305114081078" -dependencies = [ - "bytes", - "futures-core", - "futures-sink", - "pin-project-lite", - "tokio", -] - -[[package]] -name = "typenum" -version = "1.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" - -[[package]] -name = "unicode-bidi" -version = "0.3.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c1cb5db39152898a79168971543b1cb5020dff7fe43c8dc468b0885f5e29df5" - -[[package]] -name = "unicode-ident" -version = "1.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" - -[[package]] -name = "unicode-normalization" -version = "0.1.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956" -dependencies = [ - "tinyvec", -] - -[[package]] -name = "unicode-properties" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e70f2a8b45122e719eb623c01822704c4e0907e7e426a05927e1a1cfff5b75d0" - -[[package]] -name = "url" -version = "2.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60" -dependencies = [ - "form_urlencoded", - "idna", - "percent-encoding", -] - -[[package]] -name = "utf16_iter" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246" - -[[package]] -name = "utf8_iter" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" - -[[package]] -name = "uuid" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" - -[[package]] -name = "value-trait" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9170e001f458781e92711d2ad666110f153e4e50bfd5cbd02db6547625714187" -dependencies = [ - "float-cmp", - "halfbrown", - "itoa", - "ryu", -] - -[[package]] -name = "version_check" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" - -[[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" - -[[package]] -name = "wasi" -version = "0.13.3+wasi-0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26816d2e1a4a36a2940b96c5296ce403917633dff8f3440e9b236ed6f6bacad2" -dependencies = [ - "wit-bindgen-rt", -] - -[[package]] -name = "wasite" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b" - -[[package]] -name = "wasm-bindgen" -version = "0.2.100" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5" -dependencies = [ - "cfg-if", - "once_cell", - "rustversion", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.100" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6" -dependencies = [ - "bumpalo", - "log", - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.100" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.100" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.100" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "web-sys" -version = "0.3.77" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33b6dd2ef9186f1f2072e409e99cd22a975331a6b3591b12c764e0e55c60d5d2" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "whoami" -version = "1.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "372d5b87f58ec45c384ba03563b03544dc5fadc3983e434b286913f5b4a9bb6d" -dependencies = [ - "redox_syscall", - "wasite", - "web-sys", -] - -[[package]] -name = "windows-core" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" -dependencies = [ - "windows-targets", -] - -[[package]] -name = "windows-link" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6dccfd733ce2b1753b03b6d3c65edf020262ea35e20ccdf3e288043e6dd620e3" - -[[package]] -name = "windows-sys" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" -dependencies = [ - "windows-targets", -] - -[[package]] -name = "windows-targets" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" -dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_gnullvm", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" - -[[package]] -name = "windows_i686_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" - -[[package]] -name = "windows_i686_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" - -[[package]] -name = "windows_i686_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" - -[[package]] -name = "wit-bindgen-rt" -version = "0.33.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3268f3d866458b787f390cf61f4bbb563b922d091359f9608842999eaee3943c" -dependencies = [ - "bitflags", -] - -[[package]] -name = "write16" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" - -[[package]] -name = "writeable" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" - -[[package]] -name = "xml-rs" -version = "0.8.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5b940ebc25896e71dd073bad2dbaa2abfe97b0a391415e22ad1326d9c54e3c4" - -[[package]] -name = "yoke" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "120e6aef9aa629e3d4f52dc8cc43a015c7724194c97dfaf45180d2daf2b77f40" -dependencies = [ - "serde", - "stable_deref_trait", - "yoke-derive", - "zerofrom", -] - -[[package]] -name = "yoke-derive" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "synstructure", -] - -[[package]] -name = "zerocopy" -version = "0.7.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" -dependencies = [ - "zerocopy-derive 0.7.35", -] - -[[package]] -name = "zerocopy" -version = "0.8.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd97444d05a4328b90e75e503a34bad781f14e28a823ad3557f0750df1ebcbc6" -dependencies = [ - "zerocopy-derive 0.8.23", -] - -[[package]] -name = "zerocopy-derive" -version = "0.7.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "zerocopy-derive" -version = "0.8.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6352c01d0edd5db859a63e2605f4ea3183ddbd15e2c4a9e7d32184df75e4f154" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "zerofrom" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5" -dependencies = [ - "zerofrom-derive", -] - -[[package]] -name = "zerofrom-derive" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "synstructure", -] - -[[package]] -name = "zerovec" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa2b893d79df23bfb12d5461018d408ea19dfafe76c2c7ef6d4eba614f8ff079" -dependencies = [ - "yoke", - "zerofrom", - "zerovec-derive", -] - -[[package]] -name = "zerovec-derive" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] diff --git a/frameworks/Rust/hyperlane/Cargo.toml b/frameworks/Rust/hyperlane/Cargo.toml index cb0eccc2e0b..8b909a01df4 100644 --- a/frameworks/Rust/hyperlane/Cargo.toml +++ b/frameworks/Rust/hyperlane/Cargo.toml @@ -18,13 +18,10 @@ exclude = [ ] [dependencies] -hyperlane = "4.31.1" -bb8 = "0.9.0" -bb8-postgres = "0.9.0" +hyperlane = "4.36.1" rand = "0.9.0" -tokio-postgres = { version = "0.7.13", features = ["with-uuid-0_8"] } -chrono = "0.4.40" serde = "1.0.219" +sqlx = { version = "0.8.3", features = ["runtime-tokio", "postgres"] } [profile.dev] incremental = false @@ -43,3 +40,6 @@ panic = "unwind" debug = false codegen-units = 1 strip = "debuginfo" + +[features] +dev = [] diff --git a/frameworks/Rust/hyperlane/README.md b/frameworks/Rust/hyperlane/README.md index 96bf0620a7e..20ab5eec3c4 100644 --- a/frameworks/Rust/hyperlane/README.md +++ b/frameworks/Rust/hyperlane/README.md @@ -6,7 +6,7 @@ Hyperlane is a lightweight and high-performance Rust HTTP server library designe ## Database -PostgreSQL +PostgreSQL. ## Test URLs @@ -20,8 +20,20 @@ PostgreSQL ### Test 3: Multi Row Query - http://localhost:8080/queries?q=20 + http://localhost:8080/query?q=20 -### Test 4: Plaintext +### Test 4: Fortunes (Template rendering) + + http://localhost:8080/fortunes + +### Test 5: Update Query + + http://localhost:8080/upda?q=20 + +### Test 6: Plaintext http://localhost:8080/plaintext + +### Test 7: Caching + + http://localhost:8080/cached-quer?c=20 diff --git a/frameworks/Rust/hyperlane/benchmark_config.json b/frameworks/Rust/hyperlane/benchmark_config.json index b52090969ec..1f810752e18 100644 --- a/frameworks/Rust/hyperlane/benchmark_config.json +++ b/frameworks/Rust/hyperlane/benchmark_config.json @@ -6,11 +6,14 @@ "dockerfile": "hyperlane.dockerfile", "json_url": "/json", "plaintext_url": "/plaintext", + "fortune_url": "/fortunes", "db_url": "/db", - "query_url": "/queries?q=", + "query_url": "/query?q=", + "update_url": "/upda?q=", + "cached_query_url": "/cached-quer?c=", "port": 8080, "approach": "Realistic", - "classification": "Micro", + "classification": "Platform", "database": "Postgres", "framework": "hyperlane", "language": "Rust", diff --git a/frameworks/Rust/hyperlane/src/constant.rs b/frameworks/Rust/hyperlane/src/constant.rs index adc58ac641e..e22ac57c0b0 100644 --- a/frameworks/Rust/hyperlane/src/constant.rs +++ b/frameworks/Rust/hyperlane/src/constant.rs @@ -3,8 +3,13 @@ pub static DATABASE_TYPE: &str = "postgres"; pub static DATABASE_HOST: &str = "tfb-database"; pub static DATABASE_USER_NAME: &str = "benchmarkdbuser"; pub static DATABASE_USER_PASSWORD: &str = "benchmarkdbpass"; -pub static DATABASE_PORT: usize = 5432; +pub static DATABASE_PORT: usize = 5_432; pub static DATABASE_NAME: &str = "hello_world"; -pub static TABLE_NAME: &str = "World"; +pub static TABLE_NAME_WORLD: &str = "World"; +pub static TABLE_NAME_FORTUNE: &str = "Fortune"; pub static ROW_LIMIT: i32 = 500; -pub static HYPERLANE: &str = "hyperlane"; +pub static RANDOM_MAX: i32 = 10_000; +pub static RANDOM_MAX_ADD_ONE: u32 = 10_001; +pub static KEY_ID: &str = "id"; +pub static KEY_RANDOM_NUMBER: &str = "randomnumber"; +pub static KEY_MESSAGE: &str = "message"; diff --git a/frameworks/Rust/hyperlane/src/db.rs b/frameworks/Rust/hyperlane/src/db.rs index 81120b548bb..d1d51e8ee11 100644 --- a/frameworks/Rust/hyperlane/src/db.rs +++ b/frameworks/Rust/hyperlane/src/db.rs @@ -1,92 +1,108 @@ use crate::*; +#[inline] pub async fn get_db_connection() -> DbPoolConnection { - let db_pool: DbPoolConnection = DB.read().await.clone().unwrap(); + if let Some(db_pool) = DB.read().await.clone() { + return db_pool; + }; + let db_pool: DbPoolConnection = connection_db().await; + { + let mut db_pool_lock: RwLockWriteGuard<'_, Option> = DB.write().await; + *db_pool_lock = Some(db_pool.clone()); + } db_pool } +#[inline] +#[cfg(feature = "dev")] pub async fn create_batabase() { let db_pool: DbPoolConnection = get_db_connection().await; - let connection: DbConnection = db_pool.get().await.unwrap(); - let db_exists: bool = connection - .query_one( - "SELECT EXISTS(SELECT 1 FROM pg_database WHERE datname = $1);", - &[&DATABASE_NAME], - ) - .await - .unwrap() - .get(0); - if !db_exists { - println_warning!( - "database `", - DATABASE_NAME, - "` not found. Creating database..." - ); - connection - .batch_execute(&format!("CREATE DATABASE {};", DATABASE_NAME)) - .await - .unwrap(); - println_success!("database `", DATABASE_NAME, "` created successfully"); - } - println_success!("database `", DATABASE_NAME, "` ready"); + let _ = query(&format!("CREATE DATABASE {};", DATABASE_NAME)) + .execute(&db_pool) + .await; } +#[inline] +#[cfg(feature = "dev")] pub async fn create_table() { let db_pool: DbPoolConnection = get_db_connection().await; - let connection: DbConnection = db_pool.get().await.unwrap(); - connection - .batch_execute(&format!( - "CREATE TABLE IF NOT EXISTS {} ( - id SERIAL PRIMARY KEY, - randomNumber INTEGER NOT NULL - );", - TABLE_NAME - )) - .await - .unwrap(); - println_success!("table `", TABLE_NAME, "` ready"); + let _ = query(&format!( + "CREATE TABLE IF NOT EXISTS {} ( + id SERIAL PRIMARY KEY, randomNumber INT NOT NULL + );", + TABLE_NAME_WORLD + )) + .execute(&db_pool) + .await; + let _ = query(&format!( + "CREATE TABLE IF NOT EXISTS {} ( + id SERIAL PRIMARY KEY, message VARCHAR NOT NULL + );", + TABLE_NAME_FORTUNE + )) + .execute(&db_pool) + .await; } +#[inline] +#[cfg(feature = "dev")] pub async fn insert_records() { let db_pool: DbPoolConnection = get_db_connection().await; - let connection: DbConnection = db_pool.get().await.unwrap(); - let row: Row = connection - .query_one(&format!("SELECT COUNT(*) FROM {}", TABLE_NAME), &[]) + let row: PgRow = query(&format!("SELECT COUNT(*) FROM {}", TABLE_NAME_WORLD)) + .fetch_one(&db_pool) .await .unwrap(); let count: i64 = row.get(0); - let limit: i64 = ROW_LIMIT as i64; + let limit: i64 = RANDOM_MAX as i64; if count >= limit { - println_warning!(format!( - "table '{}' already has {} records. No need to insert.", - TABLE_NAME, count - )); return; } let missing_count: i64 = limit - count; - println_warning!(format!( - "table '{}' has {} records. Inserting {} missing records...", - TABLE_NAME, count, missing_count - )); - let mut rng: rand::prelude::ThreadRng = rand::rng(); let mut values: Vec = Vec::new(); for _ in 0..missing_count { - let random_number: i32 = rng.random_range(1..=10000); + let random_number: i32 = get_random_id(); values.push(format!("(DEFAULT, {})", random_number)); } - let query: String = format!( + let sql: String = format!( "INSERT INTO {} (id, randomNumber) VALUES {}", - TABLE_NAME, + TABLE_NAME_WORLD, values.join(",") ); - connection.batch_execute(&query).await.unwrap(); - println_success!(format!( - "successfully inserted {} missing records into '{}' table.", - TABLE_NAME, missing_count - )); + let _ = query(&sql).execute(&db_pool).await; + let mut values: Vec = Vec::new(); + for _ in 0..missing_count { + let random_number: i32 = get_random_id(); + values.push(format!("(DEFAULT, {})", random_number)); + } + let sql: String = format!( + "INSERT INTO {} (id, message) VALUES {}", + TABLE_NAME_FORTUNE, + values.join(",") + ); + let _ = query(&sql).execute(&db_pool).await; } -pub async fn init_db() { +#[inline] +pub async fn init_cache() { + let mut res: Vec = Vec::with_capacity(RANDOM_MAX as usize); + let db_pool: DbPoolConnection = get_db_connection().await; + let sql: String = format!( + "SELECT id, randomNumber FROM {} LIMIT {}", + TABLE_NAME_WORLD, RANDOM_MAX + ); + if let Ok(rows) = query(&sql).fetch_all(&db_pool).await { + for row in rows { + let id: i32 = row.get(KEY_ID); + let random_number: i32 = row.get(KEY_RANDOM_NUMBER); + res.push(QueryRow::new(id, random_number)); + } + } + let mut cache: RwLockWriteGuard<'_, Vec> = CACHE.write().await; + *cache = res; +} + +#[inline] +pub async fn connection_db() -> DbPoolConnection { let db_url: &str = match option_env!("POSTGRES_URL") { Some(it) => it, _ => &format!( @@ -99,37 +115,123 @@ pub async fn init_db() { DATABASE_NAME ), }; - println_warning!("db url: ", db_url); - let config: Config = db_url.parse::().unwrap(); - let db_manager: PostgresConnectionManager = - PostgresConnectionManager::new(config, NoTls); - let db_pool: DbPoolConnection = Pool::builder().build(db_manager).await.unwrap(); + let pool_size: u32 = (get_thread_count() >> 2).max(10).min(100) as u32; + let max_pool_size: u32 = option_env!("POSTGRES_MAX_POOL_SIZE") + .unwrap_or(&pool_size.to_string()) + .parse::() + .unwrap_or(pool_size); + let min_pool_size: u32 = option_env!("POSTGRES_MIN_POOL_SIZE") + .unwrap_or(&pool_size.to_string()) + .parse::() + .unwrap_or(pool_size); + let pool: DbPoolConnection = PgPoolOptions::new() + .max_connections(max_pool_size) + .min_connections(min_pool_size) + .max_lifetime(None) + .test_before_acquire(false) + .idle_timeout(None) + .connect(db_url) + .await + .unwrap(); + pool +} + +#[inline] +pub async fn get_update_data( + limit: Queries, +) -> (String, Vec, Vec, Vec) { + let db_pool: DbPoolConnection = get_db_connection().await; + let mut query_res_list: Vec = Vec::with_capacity(limit as usize); + let rows: Vec = get_some_row_id(limit, &db_pool).await; + let mut sql = format!("UPDATE {} SET randomNumber = CASE id ", TABLE_NAME_WORLD); + let mut id_list: Vec = Vec::with_capacity(rows.len()); + let mut value_list: Vec = Vec::with_capacity(rows.len() * 2); + let mut random_numbers: Vec = Vec::with_capacity(rows.len()); + for (i, row) in rows.iter().enumerate() { + let new_random_number: i32 = get_random_id() as i32; + id_list.push(row.id); + random_numbers.push(new_random_number); + value_list.push(format!("WHEN ${} THEN ${}", i * 2 + 1, i * 2 + 2)); + query_res_list.push(QueryRow::new(row.id, new_random_number)); + } + sql.push_str(&value_list.join(" ")); + let id_params: String = id_list + .iter() + .enumerate() + .map(|(i, _)| format!("${}", (rows.len() * 2 + 1) + i)) + .collect::>() + .join(","); + sql.push_str(&format!( + " ELSE randomNumber END WHERE id IN ({})", + id_params + )); + (sql, query_res_list, id_list, random_numbers) +} + +#[inline] +pub async fn init_db() { { let mut db_pool_lock: RwLockWriteGuard<'_, Option> = DB.write().await; - *db_pool_lock = Some(db_pool.clone()); + *db_pool_lock = Some(connection_db().await); + } + #[cfg(feature = "dev")] + { + create_batabase().await; + create_table().await; + insert_records().await; } - create_batabase().await; - create_table().await; - insert_records().await; + init_cache().await; +} + +#[inline] +pub async fn random_world_row(db_pool: &DbPoolConnection) -> QueryRow { + let random_id: Queries = get_random_id(); + query_world_row(db_pool, random_id).await } -pub async fn random_world_row() -> Result> { - let random_id: i32 = rand::rng().random_range(1..ROW_LIMIT); +#[inline] +pub async fn query_world_row(db_pool: &DbPoolConnection, id: Queries) -> QueryRow { + let sql: String = format!( + "SELECT id, randomNumber FROM {} WHERE id = {} LIMIT 1", + TABLE_NAME_WORLD, id + ); + if let Ok(rows) = query(&sql).fetch_one(db_pool).await { + let random_number: i32 = rows.get(KEY_RANDOM_NUMBER); + return QueryRow::new(id as i32, random_number); + } + return QueryRow::new(id as i32, 1); +} + +#[inline] +pub async fn update_world_rows(limit: Queries) -> Vec { let db_pool: DbPoolConnection = get_db_connection().await; - let connection: DbConnection = db_pool - .get() - .await - .map_err(|e| io::Error::new(io::ErrorKind::Other, format!("timeout: {}", e)))?; - let stmt: Statement = connection - .prepare(&format!( - "SELECT id, randomNumber FROM {} WHERE id = $1", - TABLE_NAME - )) - .await?; - if let Some(rows) = connection.query_opt(&stmt, &[&random_id]).await? { - let id: i32 = rows.get(0); - let random_number: i32 = rows.get(1); - return Ok(QueryRow::new(id, random_number)); + let (sql, data, id_list, random_numbers) = get_update_data(limit).await; + let mut query_builder: query::Query<'_, Postgres, postgres::PgArguments> = query(&sql); + for (id, random_number) in id_list.iter().zip(random_numbers.iter()) { + query_builder = query_builder.bind(id).bind(random_number); + } + for id in &id_list { + query_builder = query_builder.bind(id); + } + let _ = query_builder.execute(&db_pool).await; + data +} + +#[inline] +pub async fn all_world_row() -> Vec { + let db_pool: DbPoolConnection = get_db_connection().await; + let sql: String = format!("SELECT id, message FROM {}", TABLE_NAME_FORTUNE); + let res: Vec = query(&sql).fetch_all(&db_pool).await.unwrap_or_default(); + return res; +} + +#[inline] +pub async fn get_some_row_id(limit: Queries, db_pool: &DbPoolConnection) -> Vec { + let mut res: Vec = Vec::with_capacity(limit as usize); + for _ in 0..limit { + let id: i32 = get_random_id(); + let tem: QueryRow = query_world_row(db_pool, id).await; + res.push(tem); } - return Ok(QueryRow::new(0, 0)); + res } diff --git a/frameworks/Rust/hyperlane/src/lazy.rs b/frameworks/Rust/hyperlane/src/lazy.rs index 5b701e371bd..6826b018008 100644 --- a/frameworks/Rust/hyperlane/src/lazy.rs +++ b/frameworks/Rust/hyperlane/src/lazy.rs @@ -2,3 +2,4 @@ use crate::*; pub static DB: Lazy>> = Lazy::new(|| Arc::new(RwLock::new(None))); +pub static CACHE: Lazy>> = Lazy::new(|| arc_rwlock(vec![])); diff --git a/frameworks/Rust/hyperlane/src/main.rs b/frameworks/Rust/hyperlane/src/main.rs index d0145b343da..ef4a7838faa 100644 --- a/frameworks/Rust/hyperlane/src/main.rs +++ b/frameworks/Rust/hyperlane/src/main.rs @@ -8,36 +8,31 @@ pub(crate) mod server; pub(crate) mod r#type; pub(crate) mod utils; -pub(crate) use bb8::{Pool, PooledConnection}; -pub(crate) use bb8_postgres::PostgresConnectionManager; -pub(crate) use chrono::{DateTime, Utc}; pub(crate) use constant::*; pub(crate) use db::*; pub(crate) use hyperlane::{ once_cell::sync::Lazy, serde::*, serde_json::json, - tokio::sync::{RwLock, RwLockWriteGuard}, + tokio::sync::{RwLock, RwLockReadGuard, RwLockWriteGuard}, *, }; pub(crate) use lazy::*; pub(crate) use r#type::*; -pub(crate) use rand::Rng; +pub(crate) use rand::{rngs::SmallRng, Rng, SeedableRng}; pub(crate) use request_middleware::*; pub(crate) use response_middleware::*; pub(crate) use route::*; - pub(crate) use server::*; -pub(crate) use std::time::SystemTime; -pub(crate) use std::{io, sync::Arc}; -pub(crate) use tokio_postgres::{Config, NoTls, Row, Statement}; +pub(crate) use sqlx::{ + postgres::{PgPoolOptions, PgRow}, + *, +}; +pub(crate) use std::{fmt, sync::Arc}; pub(crate) use utils::*; #[tokio::main] async fn main() { - println_warning!("start connect db"); init_db().await; - println_success!("connect db finish"); - println_warning!("start init server"); run_server().await; } diff --git a/frameworks/Rust/hyperlane/src/request_middleware.rs b/frameworks/Rust/hyperlane/src/request_middleware.rs index b1ffc0fd2fa..fe810b0a1d5 100644 --- a/frameworks/Rust/hyperlane/src/request_middleware.rs +++ b/frameworks/Rust/hyperlane/src/request_middleware.rs @@ -1,17 +1,15 @@ use crate::*; +#[inline] pub async fn request(controller_data: ControllerData) { let _ = controller_data .set_response_header(CONNECTION, CONNECTION_KEEP_ALIVE) .await - .set_response_header( - CONTENT_TYPE, - format!("{}; {}", APPLICATION_JSON, CHARSET_UTF_8), - ) + .set_response_header(CONTENT_TYPE, APPLICATION_JSON) .await .set_response_header(SERVER, HYPERLANE) .await - .set_response_header(DATE, generate_rfc1123_timestamp()) + .set_response_header(DATE, current_date_gmt()) .await .set_response_status_code(200) .await; diff --git a/frameworks/Rust/hyperlane/src/response_middleware.rs b/frameworks/Rust/hyperlane/src/response_middleware.rs index 81fb0c368e9..dcf3b096b10 100644 --- a/frameworks/Rust/hyperlane/src/response_middleware.rs +++ b/frameworks/Rust/hyperlane/src/response_middleware.rs @@ -1,5 +1,6 @@ use crate::*; +#[inline] pub async fn response(controller_data: ControllerData) { let _ = controller_data.send().await; } diff --git a/frameworks/Rust/hyperlane/src/route.rs b/frameworks/Rust/hyperlane/src/route.rs index fce11dbc1ca..e52db693195 100644 --- a/frameworks/Rust/hyperlane/src/route.rs +++ b/frameworks/Rust/hyperlane/src/route.rs @@ -1,5 +1,6 @@ use crate::*; +#[inline] pub async fn json(controller_data: ControllerData) { let json: serde_json::Value = json!({ "message": RESPONSEDATA @@ -9,6 +10,7 @@ pub async fn json(controller_data: ControllerData) { .await; } +#[inline] pub async fn plaintext(controller_data: ControllerData) { let _ = controller_data .set_response_header(CONTENT_TYPE, TEXT_PLAIN) @@ -17,28 +19,89 @@ pub async fn plaintext(controller_data: ControllerData) { .await; } +#[inline] pub async fn db(controller_data: ControllerData) { - let query_row: QueryRow = random_world_row().await.unwrap(); + let db_connection: DbPoolConnection = get_db_connection().await; + let query_row: QueryRow = random_world_row(&db_connection).await; let _ = controller_data .set_response_body(serde_json::to_string(&query_row).unwrap_or_default()) .await; } +#[inline] pub async fn queries(controller_data: ControllerData) { let queries: Queries = controller_data .get_request_query("q") .await .and_then(|queries| queries.parse::().ok()) .unwrap_or_default() - .min(ROW_LIMIT as usize) + .min(ROW_LIMIT as Queries) .max(1); - let mut data: Vec = Vec::with_capacity(queries); + let mut data: Vec = Vec::with_capacity(queries as usize); + let db_pool: DbPoolConnection = get_db_connection().await; for _ in 0..queries { - let _ = random_world_row().await.map(|row| { - data.push(row); - }); + let row: QueryRow = random_world_row(&db_pool).await; + data.push(row); } let _ = controller_data .set_response_body(serde_json::to_string(&data).unwrap_or_default()) .await; } + +#[inline] +pub async fn fortunes(controller_data: ControllerData) { + let all_rows: Vec = all_world_row().await; + let mut fortunes_list: Vec = all_rows + .iter() + .map(|row| { + let id: i32 = row.get(KEY_ID); + let message: String = row.get(KEY_MESSAGE); + Fortunes::new(id, message) + }) + .collect(); + fortunes_list.push(Fortunes::new( + 0, + "Additional fortune added at request time.".to_owned(), + )); + fortunes_list.sort_by(|it, next| it.message.cmp(&next.message)); + let res: String = FortunesTemplate::new(fortunes_list).to_string(); + controller_data + .set_response_header(CONTENT_TYPE, content_type_charset(TEXT_HTML, UTF8)) + .await + .set_response_body(res) + .await; +} + +#[inline] +pub async fn updates(controller_data: ControllerData) { + let queries: Queries = controller_data + .get_request_query("q") + .await + .and_then(|queries| queries.parse::().ok()) + .unwrap_or_default() + .min(ROW_LIMIT as Queries) + .max(1); + let res: Vec = update_world_rows(queries).await; + let _ = controller_data + .set_response_body(serde_json::to_string(&res).unwrap_or_default()) + .await; +} + +#[inline] +pub async fn cached_queries(controller_data: ControllerData) { + let count: Queries = controller_data + .get_request_query("c") + .await + .and_then(|queries| queries.parse::().ok()) + .unwrap_or_default() + .min(ROW_LIMIT as Queries) + .max(1); + let mut res: Vec = Vec::with_capacity(count as usize); + let cache: RwLockReadGuard<'_, Vec> = CACHE.read().await; + for i in 0..count { + res.push(cache[i as usize].clone()); + } + let _ = controller_data + .set_response_body(serde_json::to_string(&res).unwrap_or_default()) + .await; +} diff --git a/frameworks/Rust/hyperlane/src/server.rs b/frameworks/Rust/hyperlane/src/server.rs index 7042eab442b..91dc1aeea08 100644 --- a/frameworks/Rust/hyperlane/src/server.rs +++ b/frameworks/Rust/hyperlane/src/server.rs @@ -1,18 +1,22 @@ use crate::*; +#[inline] pub async fn run_server() { let mut server: Server = Server::new(); server.host("0.0.0.0").await; server.port(8080).await; server.log_dir("./logs").await; server.log_interval_millis(1_000_000_000).await; - server.disable_print().await; + server.disable_inner_log().await; + server.disable_inner_print().await; server.route("/json", json).await; server.route("/plaintext", plaintext).await; server.route("/db", db).await; - server.route("/queries", queries).await; + server.route("/query", queries).await; + server.route("/fortunes", fortunes).await; + server.route("/upda", updates).await; + server.route("/cached-quer", cached_queries).await; server.request_middleware(request).await; server.response_middleware(response).await; - println_success!("server initialization completed"); server.listen().await; } diff --git a/frameworks/Rust/hyperlane/src/type.rs b/frameworks/Rust/hyperlane/src/type.rs index 5e524ede2e9..3fb320ba049 100644 --- a/frameworks/Rust/hyperlane/src/type.rs +++ b/frameworks/Rust/hyperlane/src/type.rs @@ -1,21 +1,61 @@ use crate::*; -pub type DbPoolConnection = bb8::Pool>; -pub type DbConnection<'a> = PooledConnection<'a, PostgresConnectionManager>; -pub type Queries = usize; +pub type DbPoolConnection = Pool; +pub type Queries = i32; #[allow(bad_style)] -#[derive(Serialize)] +#[derive(Serialize, Default, Clone)] pub struct QueryRow { - id: i32, - randomNumber: i32, + pub id: Queries, + pub randomNumber: Queries, } impl QueryRow { - pub fn new(id: i32, random_number: i32) -> Self { + #[inline] + pub fn new(id: Queries, random_number: Queries) -> Self { Self { - id: id, + id, randomNumber: random_number, } } } + +#[derive(Serialize)] +pub struct Fortunes { + pub id: Queries, + pub message: String, +} + +impl Fortunes { + #[inline] + pub fn new(id: Queries, message: String) -> Self { + Self { id, message } + } +} + +#[derive(Serialize)] +pub struct FortunesTemplate(pub Vec); + +impl FortunesTemplate { + #[inline] + pub fn new(list: Vec) -> Self { + Self(list) + } +} + +impl fmt::Display for FortunesTemplate { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + let fortunes: &Vec = &self.0; + let _ = write!(f, "Fortunes"); + for tem in fortunes.iter() { + let row: String = format!( + "", + tem.id, + escape_html(&tem.message) + ); + let _ = write!(f, "{}", row); + } + let _ = write!(f, "
idmessage
{}{}
"); + Ok(()) + } +} diff --git a/frameworks/Rust/hyperlane/src/utils.rs b/frameworks/Rust/hyperlane/src/utils.rs index c189f0be8db..9552fe79074 100644 --- a/frameworks/Rust/hyperlane/src/utils.rs +++ b/frameworks/Rust/hyperlane/src/utils.rs @@ -1,6 +1,26 @@ +use rand::rng; + use crate::*; -pub fn generate_rfc1123_timestamp() -> String { - let now: DateTime = SystemTime::now().into(); - now.format("%a, %d %b %Y %H:%M:%S GMT").to_string() +#[inline] +pub fn escape_html(input: &str) -> String { + let mut result: String = String::new(); + for ch in input.chars() { + match ch { + '<' => result.push_str("<"), + '>' => result.push_str(">"), + '&' => result.push_str("&"), + '"' => result.push_str("""), + '\'' => result.push_str("'"), + _ => result.push(ch), + } + } + result +} + +#[inline] +pub fn get_random_id() -> Queries { + let mut rng: SmallRng = SmallRng::from_rng(&mut rng()); + let random_id: u32 = rng.random_range(1..RANDOM_MAX_ADD_ONE); + random_id as Queries } From 83ee3c93709e1fc942fa8319ad09c0b82d256401 Mon Sep 17 00:00:00 2001 From: Kayden <143221653+Kayden1412@users.noreply.github.com> Date: Mon, 17 Mar 2025 22:53:20 +0700 Subject: [PATCH 09/39] [Zig/Httpz] Remove Mustache and Optimize Date Updates (#9678) * [Zig/Httpz] calculate date on another thread * [Zig/Httpz] fix build error * [Zig/Httpz] fix build error 2 * [Zig/Httpz] fix build error 3 * [Zig/Httpz] fix #4 * [Zig/Httpz] proper escape * [Zig/Htttpz] update run.sh * [Zig/Httpz] update dockerfile * [Zig/Httpz] update dockerfile 2 * [Zig/Httpz] update dockerfile 3 * [Zig/Httpz] update dockerfile 4 * [Zig/Httpz] update dockerfile 5 * update dockerfile 6 * update dockerfile 7 * update doclerfile 8 * update dockerfile 9 --- frameworks/Zig/httpz/build.zig | 2 - frameworks/Zig/httpz/build.zig.zon | 4 - frameworks/Zig/httpz/httpz.dockerfile | 23 +++--- frameworks/Zig/httpz/run.sh | 3 - frameworks/Zig/httpz/src/endpoints.zig | 100 ++++++++----------------- frameworks/Zig/httpz/src/main.zig | 41 +++++----- 6 files changed, 65 insertions(+), 108 deletions(-) delete mode 100644 frameworks/Zig/httpz/run.sh diff --git a/frameworks/Zig/httpz/build.zig b/frameworks/Zig/httpz/build.zig index 510dfbecfa2..16a4bb64845 100644 --- a/frameworks/Zig/httpz/build.zig +++ b/frameworks/Zig/httpz/build.zig @@ -16,12 +16,10 @@ pub fn build(b: *std.Build) !void { const httpz_module = b.dependency("httpz", dep_opts).module("httpz"); const pg_module = b.dependency("pg", dep_opts).module("pg"); const datetimez_module = b.dependency("datetimez", dep_opts).module("zig-datetime"); - const mustache_module = b.dependency("mustache", dep_opts).module("mustache"); exe.root_module.addImport("httpz", httpz_module); exe.root_module.addImport("pg", pg_module); exe.root_module.addImport("datetimez", datetimez_module); - exe.root_module.addImport("mustache", mustache_module); // This declares intent for the executable to be installed into the // standard location when the user invokes the "install" step (the default diff --git a/frameworks/Zig/httpz/build.zig.zon b/frameworks/Zig/httpz/build.zig.zon index 58b494c2fe3..83c29e48929 100644 --- a/frameworks/Zig/httpz/build.zig.zon +++ b/frameworks/Zig/httpz/build.zig.zon @@ -12,8 +12,4 @@ .url = "git+https://github.com/frmdstryr/zig-datetime#70aebf28fb3e137cd84123a9349d157a74708721", .hash = "122077215ce36e125a490e59ec1748ffd4f6ba00d4d14f7308978e5360711d72d77f", }, - .mustache = .{ - .url = "git+https://github.com/batiati/mustache-zig#ae5ecc1522da983dc39bb0d8b27f5d1b1d7956e3", - .hash = "1220ac9e3316ce71ad9cd66c7f215462bf5c187828b50bb3d386549bf6af004e3bb0", - }, } } diff --git a/frameworks/Zig/httpz/httpz.dockerfile b/frameworks/Zig/httpz/httpz.dockerfile index 5257b77ea18..ea4f9a7f76d 100644 --- a/frameworks/Zig/httpz/httpz.dockerfile +++ b/frameworks/Zig/httpz/httpz.dockerfile @@ -1,6 +1,4 @@ -FROM fedora:40 - -WORKDIR /httpz +FROM debian:12.9 ENV PG_USER=benchmarkdbuser ENV PG_PASS=benchmarkdbpass @@ -8,16 +6,23 @@ ENV PG_DB=hello_world ENV PG_HOST=tfb-database ENV PG_PORT=5432 +WORKDIR /app + COPY src src COPY build.zig.zon build.zig.zon COPY build.zig build.zig -COPY run.sh run.sh -RUN dnf install -y zig -RUN zig version -RUN zig build -Doptimize=ReleaseFast -RUN cp /httpz/zig-out/bin/httpz /usr/local/bin +ARG ZIG_VER=0.13.0 + +RUN apt-get update && apt-get install -y curl xz-utils ca-certificates + +RUN curl https://ziglang.org/download/${ZIG_VER}/zig-linux-$(uname -m)-${ZIG_VER}.tar.xz -o zig-linux.tar.xz && \ + tar xf zig-linux.tar.xz && \ + mv zig-linux-$(uname -m)-${ZIG_VER}/ /opt/zig + +RUN /opt/zig/zig build -Doptimize=ReleaseFast EXPOSE 3000 +RUN ls -CMD ["sh", "run.sh"] \ No newline at end of file +CMD ["zig-out/bin/httpz"] diff --git a/frameworks/Zig/httpz/run.sh b/frameworks/Zig/httpz/run.sh deleted file mode 100644 index a849756041d..00000000000 --- a/frameworks/Zig/httpz/run.sh +++ /dev/null @@ -1,3 +0,0 @@ -echo "Waiting for Httpz framework to start..." - -httpz 3000 \ No newline at end of file diff --git a/frameworks/Zig/httpz/src/endpoints.zig b/frameworks/Zig/httpz/src/endpoints.zig index a0f4476dab6..b8cfe9757fb 100644 --- a/frameworks/Zig/httpz/src/endpoints.zig +++ b/frameworks/Zig/httpz/src/endpoints.zig @@ -2,16 +2,12 @@ const std = @import("std"); const httpz = @import("httpz"); const pg = @import("pg"); const datetimez = @import("datetimez"); -const mustache = @import("mustache"); -const Thread = std.Thread; -const Mutex = Thread.Mutex; -const template = "Fortunes{{#fortunes}}{{/fortunes}}
idmessage
{{id}}{{message}}
"; +pub var date_str: []u8 = ""; pub const Global = struct { pool: *pg.Pool, rand: *std.rand.Random, - mutex: std.Thread.Mutex = .{}, }; const World = struct { @@ -40,9 +36,7 @@ pub fn json(_: *Global, _: *httpz.Request, res: *httpz.Response) !void { pub fn db(global: *Global, _: *httpz.Request, res: *httpz.Response) !void { try setHeaders(res.arena, res); - global.mutex.lock(); const random_number = 1 + (global.rand.uintAtMostBiased(u32, 9999)); - global.mutex.unlock(); const world = getWorld(global.pool, random_number) catch |err| { std.debug.print("Error querying database: {}\n", .{err}); @@ -76,31 +70,37 @@ fn getWorld(pool: *pg.Pool, random_number: u32) !World { fn setHeaders(allocator: std.mem.Allocator, res: *httpz.Response) !void { res.header("Server", "Httpz"); - const now = datetimez.datetime.Date.now(); - const time = datetimez.datetime.Time.now(); + //const now = datetimez.datetime.Date.now(); + //const time = datetimez.datetime.Time.now(); // Wed, 17 Apr 2013 12:00:00 GMT // Return date in ISO format YYYY-MM-DD - const TB_DATE_FMT = "{s:0>3}, {d:0>2} {s:0>3} {d:0>4} {d:0>2}:{d:0>2}:{d:0>2} GMT"; - const now_str = try std.fmt.allocPrint(allocator, TB_DATE_FMT, .{ now.weekdayName()[0..3], now.day, now.monthName()[0..3], now.year, time.hour, time.minute, time.second }); + //const TB_DATE_FMT = "{s:0>3}, {d:0>2} {s:0>3} {d:0>4} {d:0>2}:{d:0>2}:{d:0>2} GMT"; + //const now_str = try std.fmt.allocPrint(allocator, TB_DATE_FMT, .{ now.weekdayName()[0..3], now.day, now.monthName()[0..3], now.year, time.hour, time.minute, time.second }); //defer allocator.free(now_str); - res.header("Date", now_str); + res.header("Date", try allocator.dupe(u8, date_str)); } fn getFortunesHtml(allocator: std.mem.Allocator, pool: *pg.Pool) ![]const u8 { const fortunes = try getFortunes(allocator, pool); - const raw = try mustache.allocRenderText(allocator, template, .{ .fortunes = fortunes }); + var sb = try std.ArrayListUnmanaged(u8).initCapacity(allocator, 0); - // std.debug.print("mustache output {s}\n", .{raw}); + const writer = sb.writer(allocator); + try sb.appendSlice(allocator, "Fortunes"); - const html = try deescapeHtml(allocator, raw); + for (fortunes) |ft| { + try writer.print("", .{ + ft.id, + try escape_html(allocator, ft.message), + }); + } - // std.debug.print("html output {s}\n", .{html}); + try sb.appendSlice(allocator, "
idmessage
{d}{s}
"); - return html; + return sb.toOwnedSlice(allocator); } fn getFortunes(allocator: std.mem.Allocator, pool: *pg.Pool) ![]const Fortune { @@ -110,18 +110,18 @@ fn getFortunes(allocator: std.mem.Allocator, pool: *pg.Pool) ![]const Fortune { var rows = try conn.query("SELECT id, message FROM Fortune", .{}); defer rows.deinit(); - var fortunes = std.ArrayList(Fortune).init(allocator); - defer fortunes.deinit(); + var fortunes = try std.ArrayListUnmanaged(Fortune).initCapacity(allocator, 0); + defer fortunes.deinit(allocator); while (try rows.next()) |row| { const current_fortune = Fortune{ .id = row.get(i32, 0), .message = row.get([]const u8, 1) }; - try fortunes.append(current_fortune); + try fortunes.append(allocator, current_fortune); } const zero_fortune = Fortune{ .id = 0, .message = "Additional fortune added at request time." }; - try fortunes.append(zero_fortune); + try fortunes.append(allocator, zero_fortune); - const fortunes_slice = try fortunes.toOwnedSlice(); + const fortunes_slice = try fortunes.toOwnedSlice(allocator); std.mem.sort(Fortune, fortunes_slice, {}, cmpFortuneByMessage); return fortunes_slice; @@ -131,53 +131,17 @@ fn cmpFortuneByMessage(_: void, a: Fortune, b: Fortune) bool { return std.mem.order(u8, a.message, b.message).compare(std.math.CompareOperator.lt); } -fn deescapeHtml(allocator: std.mem.Allocator, input: []const u8) ![]const u8 { - var output = std.ArrayList(u8).init(allocator); - defer output.deinit(); - - var i: usize = 0; - while (i < input.len) { - if (std.mem.startsWith(u8, input[i..], " ")) { - try output.append(' '); - i += 5; - } else if (std.mem.startsWith(u8, input[i..], """)) { - try output.append('"'); - i += 5; - } else if (std.mem.startsWith(u8, input[i..], "&")) { - try output.append('&'); - i += 5; - } else if (std.mem.startsWith(u8, input[i..], "'")) { - try output.append('\''); - i += 5; - } else if (std.mem.startsWith(u8, input[i..], "(")) { - try output.append('('); - i += 5; - } else if (std.mem.startsWith(u8, input[i..], ")")) { - try output.append(')'); - i += 5; - } else if (std.mem.startsWith(u8, input[i..], "+")) { - try output.append('+'); - i += 5; - } else if (std.mem.startsWith(u8, input[i..], ",")) { - try output.append(','); - i += 5; - } else if (std.mem.startsWith(u8, input[i..], ".")) { - try output.append('.'); - i += 5; - } else if (std.mem.startsWith(u8, input[i..], "/")) { - try output.append('/'); - i += 5; - } else if (std.mem.startsWith(u8, input[i..], ":")) { - try output.append(':'); - i += 5; - } else if (std.mem.startsWith(u8, input[i..], ";")) { - try output.append(';'); - i += 5; - } else { - try output.append(input[i]); - i += 1; +fn escape_html(allocator: std.mem.Allocator, input: []const u8) ![]const u8 { + var output = try std.ArrayListUnmanaged(u8).initCapacity(allocator, 0); + defer output.deinit(allocator); + + for (input) |char| { + switch (char) { + '<' => try output.appendSlice(allocator, "<"), + '>' => try output.appendSlice(allocator, ">"), + else => try output.append(allocator, char), } } - return output.toOwnedSlice(); + return output.toOwnedSlice(allocator); } diff --git a/frameworks/Zig/httpz/src/main.zig b/frameworks/Zig/httpz/src/main.zig index b7fd4850bc2..dd5b3966b2f 100644 --- a/frameworks/Zig/httpz/src/main.zig +++ b/frameworks/Zig/httpz/src/main.zig @@ -20,6 +20,24 @@ pub fn main() !void { var pg_pool = try pool.initPool(allocator); defer pg_pool.deinit(); + const date_thread = try std.Thread.spawn(.{}, struct { + fn update() !void { + const ally = std.heap.page_allocator; + while (true) { + const now = datetimez.datetime.Date.now(); + const time = datetimez.datetime.Time.now(); + + // Wed, 17 Apr 2013 12:00:00 GMT + // Return date in ISO format YYYY-MM-DD + const TB_DATE_FMT = "{s:0>3}, {d:0>2} {s:0>3} {d:0>4} {d:0>2}:{d:0>2}:{d:0>2} GMT"; + endpoints.date_str = try std.fmt.allocPrint(ally, TB_DATE_FMT, .{ now.weekdayName()[0..3], now.day, now.monthName()[0..3], now.year, time.hour, time.minute, time.second }); + std.time.sleep(std.time.ns_per_ms * 980); + } + } + }.update, .{}); + + date_thread.detach(); + var prng = std.rand.DefaultPrng.init(@as(u64, @bitCast(std.time.milliTimestamp()))); var rand = prng.random(); @@ -29,10 +47,7 @@ pub fn main() !void { .rand = &rand, }; - const args = try std.process.argsAlloc(allocator); - - const port: u16 = if (args.len > 1) try std.fmt.parseInt(u16, args[1], 0) else 3000; - + const port: u16 = 3000; const workers = @as(u16, @intCast(16 * cpu_count)); server = try httpz.ServerApp(*endpoints.Global).init(allocator, .{ @@ -55,10 +70,6 @@ pub fn main() !void { // static buffers. For example, if response headers don't fit in in // $response.header_buffer_size, a buffer will be pulled from here. // This is per-worker. - .large_buffer_count = 16, - - // The size of each large buffer. - .large_buffer_size = 65536, // Size of bytes retained for the connection arena between use. This will // result in up to `count * min_conn * retain_allocated_bytes` of memory usage. @@ -77,22 +88,8 @@ pub fn main() !void { // This applies back pressure to the above workers and ensures that, under load // pending requests get precedence over processing new requests. .backlog = 2048, - - // Size of the static buffer to give each thread. Memory usage will be - // `count * buffer_size`. If you're making heavy use of either `req.arena` or - // `res.arena`, this is likely the single easiest way to gain performance. - .buffer_size = 8192, }, .request = .{ - // Maximum request body size that we'll process. We can allocate up - // to this much memory per request for the body. Internally, we might - // keep this memory around for a number of requests as an optimization. - .max_body_size = 1_048_576, - - // This memory is allocated upfront. The request header _must_ fit into - // this space, else the request will be rejected. - .buffer_size = 4_096, - // Maximum number of headers to accept. // Additional headers will be silently ignored. .max_header_count = 32, From b73a8a2f8ec908d68256832429575ead6ca554c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B5=B7=E5=AD=90=20Yang?= Date: Mon, 17 Mar 2025 23:55:47 +0800 Subject: [PATCH 10/39] Add cached query tests (#9680) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add new framework Java/today * change build config * :arrow_up: 升级版本 4.0.0-Draft.6 * 更新 /updates API * 打开日志 * :fire: 删除 /updates API 偶尔会出错,目前尚未找到原因 * :art: 更新 /updates API * :art: 添加 epoll 支持 * :fire: remove all of the files that aren't necessary for the tests * :art: .gitignore * :art: 优化构建 * :sparkles: 更新框架,新增 cached_query_url * :art: 优化使用方式 * :art: 优化使用方式 * :art: * :art: * :art: 修改 cached queries 地址 --- frameworks/Java/today/.gitignore | 3 +- frameworks/Java/today/README.md | 4 ++ frameworks/Java/today/benchmark_config.json | 3 +- frameworks/Java/today/build.gradle | 28 +++++--- frameworks/Java/today/config.toml | 1 + frameworks/Java/today/gradle.properties | 6 +- .../cn/taketoday/benchmark/AppConfig.java | 63 ++++++++++------ .../benchmark/BenchmarkApplication.java | 4 +- .../benchmark/http/BenchmarkHttpHandler.java | 71 ++++++++++--------- .../taketoday/benchmark/http/WorldCache.java | 28 ++++++++ .../benchmark/http/package-info.java | 6 ++ .../cn/taketoday/benchmark/model/Fortune.java | 7 +- .../cn/taketoday/benchmark/model/Message.java | 14 ++++ .../cn/taketoday/benchmark/model/World.java | 17 +++-- .../benchmark/model/package-info.java | 6 ++ .../cn/taketoday/benchmark/package-info.java | 6 ++ .../src/main/resources/application-test.yaml | 9 +-- .../today/src/main/resources/application.yaml | 7 +- frameworks/Java/today/today.dockerfile | 14 ++-- 19 files changed, 205 insertions(+), 92 deletions(-) create mode 100644 frameworks/Java/today/src/main/java/cn/taketoday/benchmark/http/WorldCache.java create mode 100644 frameworks/Java/today/src/main/java/cn/taketoday/benchmark/http/package-info.java create mode 100644 frameworks/Java/today/src/main/java/cn/taketoday/benchmark/model/Message.java create mode 100644 frameworks/Java/today/src/main/java/cn/taketoday/benchmark/model/package-info.java create mode 100644 frameworks/Java/today/src/main/java/cn/taketoday/benchmark/package-info.java diff --git a/frameworks/Java/today/.gitignore b/frameworks/Java/today/.gitignore index ea1cbb085ef..ed040c778b1 100644 --- a/frameworks/Java/today/.gitignore +++ b/frameworks/Java/today/.gitignore @@ -6,4 +6,5 @@ build .idea today.properties -gradle \ No newline at end of file +gradle +gradlew \ No newline at end of file diff --git a/frameworks/Java/today/README.md b/frameworks/Java/today/README.md index a7c42243f25..96aa3bbbdbb 100644 --- a/frameworks/Java/today/README.md +++ b/frameworks/Java/today/README.md @@ -17,6 +17,10 @@ http://localhost:8080/db http://localhost:8080/queries?queries= +### Caching QUERY + +http://localhost:8080/cached-queries?count=10 + ### UPDATE http://localhost:8080/update?queries= diff --git a/frameworks/Java/today/benchmark_config.json b/frameworks/Java/today/benchmark_config.json index 92c3c756ad1..c44a0306ce5 100755 --- a/frameworks/Java/today/benchmark_config.json +++ b/frameworks/Java/today/benchmark_config.json @@ -9,6 +9,7 @@ "query_url": "/queries?queries=", "fortune_url": "/fortunes", "update_url": "/updates?queries=", + "cached_query_url": "/cached-queries?count=", "port": 8080, "approach": "Realistic", "classification": "Fullstack", @@ -21,7 +22,7 @@ "webserver": "None", "os": "Linux", "database_os": "Linux", - "display_name": "Today", + "display_name": "TODAY", "notes": "", "versus": "None" } diff --git a/frameworks/Java/today/build.gradle b/frameworks/Java/today/build.gradle index a95a1982f4e..0925eff2b4a 100644 --- a/frameworks/Java/today/build.gradle +++ b/frameworks/Java/today/build.gradle @@ -1,16 +1,16 @@ description = "benchmark" -apply plugin: "java" -apply plugin: "application" -apply plugin: 'cn.taketoday.application' -apply plugin: 'io.spring.dependency-management' +apply plugin: 'java' +apply plugin: 'application' +apply plugin: 'infra.application' configure(allprojects) { group = "cn.taketoday.benchmark" repositories { + mavenLocal() mavenCentral() - maven { url "https://oss.sonatype.org/content/repositories/snapshots/" } + maven { url = "https://oss.sonatype.org/content/repositories/snapshots/" } } } @@ -24,6 +24,7 @@ dependencies { implementation 'mysql:mysql-connector-java' implementation 'ch.qos.logback:logback-classic' + implementation 'com.github.ben-manes.caffeine:caffeine' implementation('io.netty:netty-transport-native-epoll') { artifact { @@ -31,6 +32,12 @@ dependencies { } } + implementation('io.netty.incubator:netty-incubator-transport-native-io_uring:0.0.21.Final') { + artifact { + classifier = 'linux-x86_64' + } + } + // implementation('io.netty:netty-transport-native-kqueue') { // artifact { // classifier = 'osx-aarch_64' @@ -40,23 +47,24 @@ dependencies { } java { - sourceCompatibility = JavaVersion.VERSION_17 - targetCompatibility = JavaVersion.VERSION_17 + sourceCompatibility = JavaVersion.VERSION_21 + targetCompatibility = JavaVersion.VERSION_21 } application { mainClass = 'cn.taketoday.benchmark.BenchmarkApplication' applicationDefaultJvmArgs = [ "-server", + "-Xms2G", + "-Xmx2G", "-XX:+UseNUMA", - "-XX:+UseG1GC", - "-XX:+DisableExplicitGC", - "-XX:-StackTraceInThrowable", "-XX:+UseStringDeduplication", "-Dinfra.profiles.active=test", "-Dio.netty.buffer.checkBounds=false", "-Dio.netty.buffer.checkAccessible=false", "-Dio.netty.leakDetection.level=disabled", + "-Dio.netty.iouring.iosqeAsyncThreshold=32000", + "-Djava.lang.Integer.IntegerCache.high=10000", "--add-opens=java.base/java.nio=ALL-UNNAMED", "--add-opens=java.base/sun.nio.ch=ALL-UNNAMED" ] diff --git a/frameworks/Java/today/config.toml b/frameworks/Java/today/config.toml index dc2e84c877d..36cf38bc9f5 100644 --- a/frameworks/Java/today/config.toml +++ b/frameworks/Java/today/config.toml @@ -8,6 +8,7 @@ urls.db = "/db" urls.query = "/queries?queries=" urls.update = "/updates?queries=" urls.fortune = "/fortunes" +urls.cached_query = "/cached-queries?count=" approach = "Realistic" classification = "Fullstack" database = "mysql" diff --git a/frameworks/Java/today/gradle.properties b/frameworks/Java/today/gradle.properties index 9379f1c95c9..088db4d0de3 100644 --- a/frameworks/Java/today/gradle.properties +++ b/frameworks/Java/today/gradle.properties @@ -1,6 +1,6 @@ -version=1.0.0 -#infraVersion=4.0.0-Draft.6-SNAPSHOT -infraVersion=4.0.0-Draft.6 +version=1.1.0 +#infraVersion=5.0-Draft.2 +infraVersion=5.0-Draft.2-SNAPSHOT org.gradle.caching=true org.gradle.jvmargs=-Xmx2048m diff --git a/frameworks/Java/today/src/main/java/cn/taketoday/benchmark/AppConfig.java b/frameworks/Java/today/src/main/java/cn/taketoday/benchmark/AppConfig.java index 1d385a77133..b5496ce042d 100644 --- a/frameworks/Java/today/src/main/java/cn/taketoday/benchmark/AppConfig.java +++ b/frameworks/Java/today/src/main/java/cn/taketoday/benchmark/AppConfig.java @@ -4,21 +4,26 @@ import javax.sql.DataSource; -import cn.taketoday.beans.factory.annotation.DisableAllDependencyInjection; -import cn.taketoday.beans.factory.config.BeanDefinition; -import cn.taketoday.context.annotation.Configuration; -import cn.taketoday.context.annotation.Role; -import cn.taketoday.framework.web.netty.NettyRequestConfig; -import cn.taketoday.framework.web.netty.SendErrorHandler; -import cn.taketoday.jdbc.RepositoryManager; -import cn.taketoday.jdbc.persistence.EntityManager; -import cn.taketoday.stereotype.Component; -import io.netty.handler.codec.http.DefaultHttpHeadersFactory; +import infra.beans.factory.annotation.DisableAllDependencyInjection; +import infra.beans.factory.config.BeanDefinition; +import infra.context.annotation.Configuration; +import infra.context.annotation.Role; +import infra.jdbc.RepositoryManager; +import infra.persistence.EntityManager; +import infra.stereotype.Component; +import infra.web.server.WebServerFactoryCustomizer; +import infra.web.server.error.SendErrorHandler; +import infra.web.server.support.NettyRequestConfig; +import infra.web.server.support.NettyWebServerFactory; +import io.netty.handler.codec.http.DefaultHttpHeaders; import io.netty.handler.codec.http.HttpHeaders; import io.netty.handler.codec.http.HttpHeadersFactory; import io.netty.handler.codec.http.multipart.DefaultHttpDataFactory; +import io.netty.incubator.channel.uring.IOUring; +import io.netty.incubator.channel.uring.IOUringEventLoopGroup; +import io.netty.incubator.channel.uring.IOUringServerSocketChannel; -import static cn.taketoday.http.HttpHeaders.DATE_FORMATTER; +import static infra.http.HttpHeaders.DATE_FORMATTER; /** * @author Harry Yang @@ -29,30 +34,41 @@ @Configuration(proxyBeanMethods = false) class AppConfig { - private static final DefaultHttpHeadersFactory headersFactory = DefaultHttpHeadersFactory.headersFactory(); - @Component - static RepositoryManager repositoryManager(DataSource dataSource) { + public static RepositoryManager repositoryManager(DataSource dataSource) { return new RepositoryManager(dataSource); } @Component - static EntityManager entityManager(RepositoryManager repositoryManager) { + public static EntityManager entityManager(RepositoryManager repositoryManager) { return repositoryManager.getEntityManager(); } + @Component + public static WebServerFactoryCustomizer factoryWebServerFactoryCustomizer() { + return factory -> { + if (IOUring.isAvailable()) { + IOUringEventLoopGroup loopGroup = new IOUringEventLoopGroup(); + factory.setAcceptorGroup(loopGroup); + factory.setWorkerGroup(loopGroup); + factory.setSocketChannel(IOUringServerSocketChannel.class); + } + }; + } + @Component @Role(BeanDefinition.ROLE_INFRASTRUCTURE) - static NettyRequestConfig nettyRequestConfig(SendErrorHandler sendErrorHandler) { + public static NettyRequestConfig nettyRequestConfig(SendErrorHandler sendErrorHandler) { var factory = new DefaultHttpDataFactory(false); - return NettyRequestConfig.forBuilder() + + return NettyRequestConfig.forBuilder(false) .httpDataFactory(factory) .sendErrorHandler(sendErrorHandler) .headersFactory(new HttpHeadersFactory() { @Override public HttpHeaders newHeaders() { - HttpHeaders headers = headersFactory.newHeaders(); + HttpHeaders headers = new ResponseHeaders(); headers.set("Server", "TODAY"); headers.set("Date", DATE_FORMATTER.format(ZonedDateTime.now())); return headers; @@ -60,11 +76,18 @@ public HttpHeaders newHeaders() { @Override public HttpHeaders newEmptyHeaders() { - return headersFactory.newEmptyHeaders(); + return new ResponseHeaders(); } }) - .secure(false) .build(); } + static class ResponseHeaders extends DefaultHttpHeaders { + + public ResponseHeaders() { + super(name -> { }, v -> { }); + } + + } + } diff --git a/frameworks/Java/today/src/main/java/cn/taketoday/benchmark/BenchmarkApplication.java b/frameworks/Java/today/src/main/java/cn/taketoday/benchmark/BenchmarkApplication.java index 0e2eea0f995..9dfe80b4d08 100644 --- a/frameworks/Java/today/src/main/java/cn/taketoday/benchmark/BenchmarkApplication.java +++ b/frameworks/Java/today/src/main/java/cn/taketoday/benchmark/BenchmarkApplication.java @@ -1,7 +1,7 @@ package cn.taketoday.benchmark; -import cn.taketoday.framework.Application; -import cn.taketoday.framework.InfraApplication; +import infra.app.Application; +import infra.app.InfraApplication; @InfraApplication public class BenchmarkApplication { diff --git a/frameworks/Java/today/src/main/java/cn/taketoday/benchmark/http/BenchmarkHttpHandler.java b/frameworks/Java/today/src/main/java/cn/taketoday/benchmark/http/BenchmarkHttpHandler.java index d0d240534bd..3000a073aab 100644 --- a/frameworks/Java/today/src/main/java/cn/taketoday/benchmark/http/BenchmarkHttpHandler.java +++ b/frameworks/Java/today/src/main/java/cn/taketoday/benchmark/http/BenchmarkHttpHandler.java @@ -2,21 +2,21 @@ import java.util.Comparator; import java.util.List; -import java.util.Map; -import java.util.Objects; import java.util.concurrent.ThreadLocalRandom; import java.util.stream.IntStream; import cn.taketoday.benchmark.model.Fortune; +import cn.taketoday.benchmark.model.Message; import cn.taketoday.benchmark.model.World; -import cn.taketoday.http.MediaType; -import cn.taketoday.http.ResponseEntity; -import cn.taketoday.jdbc.persistence.EntityManager; -import cn.taketoday.lang.Nullable; -import cn.taketoday.ui.Model; -import cn.taketoday.web.annotation.GET; -import cn.taketoday.web.annotation.RestController; -import cn.taketoday.web.view.ViewRef; +import infra.http.MediaType; +import infra.http.ResponseEntity; +import infra.lang.Nullable; +import infra.persistence.EntityManager; +import infra.ui.Model; +import infra.util.concurrent.Future; +import infra.web.annotation.GET; +import infra.web.annotation.RestController; +import infra.web.view.ViewRef; /** * @author Harry Yang @@ -26,19 +26,23 @@ final class BenchmarkHttpHandler { private static final int MIN_WORLD_NUMBER = 1; + private static final int MAX_WORLD_NUMBER = 10_000; private final EntityManager entityManager; + private final WorldCache worldCache; + BenchmarkHttpHandler(EntityManager entityManager) { this.entityManager = entityManager; + this.worldCache = new WorldCache(entityManager.find(World.class)); } @GET("/json") - public ResponseEntity> json() { + public ResponseEntity json() { return ResponseEntity.ok() .contentType(MediaType.APPLICATION_JSON) - .body(Map.of("message", "Hello, World!")); + .body(new Message("Hello, World!")); } @GET("/plaintext") @@ -46,30 +50,33 @@ public String plaintext() { return "Hello, World!"; } + @Nullable @GET("/db") public World db() { return entityManager.findById(World.class, nextInt()); } @GET("/queries") - public List queries(@Nullable String queries) { - return randomNumbers() - .mapToObj(this::findWorldById) - .limit(parseQueryCount(queries)) - .toList(); + public Future> queries(@Nullable String queries) { + return Future.combine(randomNumbers().limit(parseQueryCount(queries)).mapToObj(this::findWorldByIdFuture)) + .asList(); + } + + @GET("/cached-queries") + public List cachedQueries(@Nullable String count) { + return worldCache.getCachedWorld(parseQueryCount(count)); } @GET("/updates") - public List updates(@Nullable String queries) { - return randomNumbers() - .mapToObj(this::findWorldById) - .filter(Objects::nonNull) - .peek(world -> { + public Future> updates(@Nullable String queries) { + return Future.combine(randomNumbers() + .limit(parseQueryCount(queries)) + .mapToObj(this::findWorldByIdFuture) + .map(worldFuture -> worldFuture.map(world -> { world.setRandomNumber(nextInt()); entityManager.updateById(world); - }) - .limit(parseQueryCount(queries)) - .toList(); + return world; + }))).asList(); } @GET("/fortunes") @@ -82,9 +89,13 @@ public ViewRef fortunes(Model model) { return ViewRef.forViewName("fortunes"); } + private Future findWorldByIdFuture(int id) { + return Future.run(() -> findWorldById(id)); + } + @Nullable private World findWorldById(int id) { - return entityManager.findById(World.class, boxed[id]); + return entityManager.findById(World.class, id); } // @@ -95,12 +106,8 @@ private static IntStream randomNumbers() { .distinct(); } - private static final Integer[] boxed = IntStream.range(MIN_WORLD_NUMBER, MAX_WORLD_NUMBER + 1) - .boxed() - .toArray(Integer[]::new); - - private static Integer nextInt() { - return boxed[ThreadLocalRandom.current().nextInt(MIN_WORLD_NUMBER, MAX_WORLD_NUMBER)]; + private static int nextInt() { + return ThreadLocalRandom.current().nextInt(MIN_WORLD_NUMBER, MAX_WORLD_NUMBER); } private static int parseQueryCount(@Nullable String textValue) { diff --git a/frameworks/Java/today/src/main/java/cn/taketoday/benchmark/http/WorldCache.java b/frameworks/Java/today/src/main/java/cn/taketoday/benchmark/http/WorldCache.java new file mode 100644 index 00000000000..899dafa7470 --- /dev/null +++ b/frameworks/Java/today/src/main/java/cn/taketoday/benchmark/http/WorldCache.java @@ -0,0 +1,28 @@ +package cn.taketoday.benchmark.http; + +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.ThreadLocalRandom; + +import cn.taketoday.benchmark.model.World; + +public class WorldCache { + + private final World[] cache; + + public WorldCache(List worlds) { + this.cache = worlds.toArray(new World[0]); + } + + public List getCachedWorld(int count) { + World[] worlds = this.cache; + int length = worlds.length; + ArrayList ret = new ArrayList<>(count); + ThreadLocalRandom current = ThreadLocalRandom.current(); + for (int i = 0; i < count; i++) { + ret.add(worlds[current.nextInt(length - 1)]); + } + return ret; + } + +} \ No newline at end of file diff --git a/frameworks/Java/today/src/main/java/cn/taketoday/benchmark/http/package-info.java b/frameworks/Java/today/src/main/java/cn/taketoday/benchmark/http/package-info.java new file mode 100644 index 00000000000..4ef5fb0311b --- /dev/null +++ b/frameworks/Java/today/src/main/java/cn/taketoday/benchmark/http/package-info.java @@ -0,0 +1,6 @@ +@NonNullApi +@NonNullFields +package cn.taketoday.benchmark.http; + +import infra.lang.NonNullApi; +import infra.lang.NonNullFields; \ No newline at end of file diff --git a/frameworks/Java/today/src/main/java/cn/taketoday/benchmark/model/Fortune.java b/frameworks/Java/today/src/main/java/cn/taketoday/benchmark/model/Fortune.java index a261c1434bd..1df119d4a3d 100644 --- a/frameworks/Java/today/src/main/java/cn/taketoday/benchmark/model/Fortune.java +++ b/frameworks/Java/today/src/main/java/cn/taketoday/benchmark/model/Fortune.java @@ -2,8 +2,8 @@ import java.util.Objects; -import cn.taketoday.jdbc.persistence.Id; -import cn.taketoday.jdbc.persistence.Table; +import infra.persistence.Id; +import infra.persistence.Table; @Table("fortune") public class Fortune { @@ -13,7 +13,8 @@ public class Fortune { private String message; - public Fortune() { } + public Fortune() { + } public Fortune(Integer id, String message) { this.id = id; diff --git a/frameworks/Java/today/src/main/java/cn/taketoday/benchmark/model/Message.java b/frameworks/Java/today/src/main/java/cn/taketoday/benchmark/model/Message.java new file mode 100644 index 00000000000..fde5de5b8a8 --- /dev/null +++ b/frameworks/Java/today/src/main/java/cn/taketoday/benchmark/model/Message.java @@ -0,0 +1,14 @@ +package cn.taketoday.benchmark.model; + +public class Message { + + private final String message; + + public Message(String message) { + this.message = message; + } + + public String getMessage() { + return message; + } +} \ No newline at end of file diff --git a/frameworks/Java/today/src/main/java/cn/taketoday/benchmark/model/World.java b/frameworks/Java/today/src/main/java/cn/taketoday/benchmark/model/World.java index 04c60c8445f..4ff2a25c1d1 100644 --- a/frameworks/Java/today/src/main/java/cn/taketoday/benchmark/model/World.java +++ b/frameworks/Java/today/src/main/java/cn/taketoday/benchmark/model/World.java @@ -2,12 +2,12 @@ import java.util.Objects; -import cn.taketoday.jdbc.persistence.Column; -import cn.taketoday.jdbc.persistence.Id; -import cn.taketoday.jdbc.persistence.Table; +import infra.persistence.Column; +import infra.persistence.Id; +import infra.persistence.Table; @Table("world") -public class World { +public class World implements Comparable { @Id private Integer id; @@ -15,7 +15,8 @@ public class World { @Column("randomNumber") private Integer randomNumber; - public World() { } + public World() { + } public World(Integer id, Integer randomNumber) { this.id = id; @@ -52,4 +53,10 @@ public boolean equals(Object o) { public int hashCode() { return Objects.hash(id, randomNumber); } + + @Override + public int compareTo(World o) { + return Integer.compare(id, o.id); + } + } diff --git a/frameworks/Java/today/src/main/java/cn/taketoday/benchmark/model/package-info.java b/frameworks/Java/today/src/main/java/cn/taketoday/benchmark/model/package-info.java new file mode 100644 index 00000000000..115f7640198 --- /dev/null +++ b/frameworks/Java/today/src/main/java/cn/taketoday/benchmark/model/package-info.java @@ -0,0 +1,6 @@ +@NonNullApi +@NonNullFields +package cn.taketoday.benchmark.model; + +import infra.lang.NonNullApi; +import infra.lang.NonNullFields; \ No newline at end of file diff --git a/frameworks/Java/today/src/main/java/cn/taketoday/benchmark/package-info.java b/frameworks/Java/today/src/main/java/cn/taketoday/benchmark/package-info.java new file mode 100644 index 00000000000..518576b46e9 --- /dev/null +++ b/frameworks/Java/today/src/main/java/cn/taketoday/benchmark/package-info.java @@ -0,0 +1,6 @@ +@NonNullApi +@NonNullFields +package cn.taketoday.benchmark; + +import infra.lang.NonNullApi; +import infra.lang.NonNullFields; \ No newline at end of file diff --git a/frameworks/Java/today/src/main/resources/application-test.yaml b/frameworks/Java/today/src/main/resources/application-test.yaml index e901f8a0476..7d554af1c14 100644 --- a/frameworks/Java/today/src/main/resources/application-test.yaml +++ b/frameworks/Java/today/src/main/resources/application-test.yaml @@ -5,10 +5,11 @@ datasource: logging: level: - root: info + root: OFF server: netty: - acceptor-threads: 4 - worker-threads: 8 - max-connection: 65535 \ No newline at end of file + acceptor-threads: 8 + worker-threads: 16 + max-connection: 8192 + validate-headers: false \ No newline at end of file diff --git a/frameworks/Java/today/src/main/resources/application.yaml b/frameworks/Java/today/src/main/resources/application.yaml index 650df4454a5..aba9b42e36a 100644 --- a/frameworks/Java/today/src/main/resources/application.yaml +++ b/frameworks/Java/today/src/main/resources/application.yaml @@ -30,12 +30,9 @@ datasource: type: com.zaxxer.hikari.HikariDataSource driver-class-name: com.mysql.cj.jdbc.Driver hikari: - maximum-pool-size: 20 - max-lifetime: 120000 + maximum-pool-size: 256 connection-test-query: 'select 1' logging: level: - root: OFF - pattern: - dateformat: 'yyyy-MM-dd HH:mm:ss.SSS' \ No newline at end of file + root: OFF \ No newline at end of file diff --git a/frameworks/Java/today/today.dockerfile b/frameworks/Java/today/today.dockerfile index b063749f6b1..643bbe4c00a 100644 --- a/frameworks/Java/today/today.dockerfile +++ b/frameworks/Java/today/today.dockerfile @@ -1,11 +1,13 @@ -FROM gradle:8.6.0-jdk17 as build -COPY --chown=gradle:gradle . /home/gradle/src -WORKDIR /home/gradle/src -RUN gradle installInfraDist --no-daemon +FROM gradle:8.13.0-jdk21 as build +COPY --chown=gradle:gradle . /infra-src +WORKDIR /infra-src +RUN gradle installDist --no-daemon -FROM openjdk:21 +#FROM openjdk:21 +FROM bellsoft/liberica-openjre-debian:21.0.5 +RUN apt install findutils WORKDIR /today -COPY --from=build /home/gradle/src/build/install/today-infra-app/ ./ +COPY --from=build /infra-src/build/install/today/ ./ EXPOSE 8080 ENTRYPOINT "./bin/today" From af661274860ffcb9f836fde2b02f36eb32e5bef9 Mon Sep 17 00:00:00 2001 From: rio Date: Tue, 18 Mar 2025 01:16:51 +0900 Subject: [PATCH 11/39] [php] CakePHP remove xdebug (#9675) (#9679) --- frameworks/PHP/cakephp/cakephp-workerman.dockerfile | 2 -- frameworks/PHP/cakephp/cakephp.dockerfile | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/frameworks/PHP/cakephp/cakephp-workerman.dockerfile b/frameworks/PHP/cakephp/cakephp-workerman.dockerfile index 0339af783c9..7d275912de0 100644 --- a/frameworks/PHP/cakephp/cakephp-workerman.dockerfile +++ b/frameworks/PHP/cakephp/cakephp-workerman.dockerfile @@ -24,8 +24,6 @@ RUN composer install --optimize-autoloader --classmap-authoritative --no-dev -- RUN chmod -R 777 /cakephp -#ENV XDEBUG_CONFIG="remote_host=$(ipconfig getifaddr en0)" -ENV XDEBUG_SESSION=xdebug_is_great #COPY deploy/conf/cli-php.ini /etc/php/8.3/cli/php.ini CMD php -c deploy/conf/cli-php.ini \ diff --git a/frameworks/PHP/cakephp/cakephp.dockerfile b/frameworks/PHP/cakephp/cakephp.dockerfile index 3ebafcb9d8c..d5d39a7ea65 100644 --- a/frameworks/PHP/cakephp/cakephp.dockerfile +++ b/frameworks/PHP/cakephp/cakephp.dockerfile @@ -7,7 +7,7 @@ RUN LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php > /dev/null && \ apt-get update -yqq > /dev/null && apt-get upgrade -yqq > /dev/null RUN apt-get install -yqq nginx git unzip \ - php8.4-fpm php8.4-mysql php8.4-xml php8.4-mbstring php8.4-intl php8.4-dev php8.4-curl php-xdebug > /dev/null + php8.4-fpm php8.4-mysql php8.4-xml php8.4-mbstring php8.4-intl php8.4-dev php8.4-curl > /dev/null COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer From 551083d3ef787264f0b4f89d53f0de4a708fa45e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=85=89?= Date: Tue, 18 Mar 2025 00:35:00 +0800 Subject: [PATCH 12/39] update com.fasterxml.jackson.core:jackson-databind 2.13.4.2 to 2.16.0 (#9181) --- frameworks/Java/activeweb/pom.xml | 2 +- frameworks/Java/bayou/pom.xml | 2 +- frameworks/Java/grizzly/pom.xml | 2 +- frameworks/Java/httpserver/pom.xml | 2 +- frameworks/Java/jlhttp/pom.xml | 2 +- frameworks/Java/microhttp/pom.xml | 2 +- frameworks/Java/nanohttpd/pom.xml | 2 +- frameworks/Java/servlet/pom.xml | 2 +- frameworks/Java/servlet3/pom.xml | 2 +- frameworks/Java/tapestry/pom.xml | 2 +- frameworks/Java/undertow-jersey/pom.xml | 2 +- frameworks/Java/undertow/pom.xml | 2 +- frameworks/Prolog/tuProlog/pom.xml | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/frameworks/Java/activeweb/pom.xml b/frameworks/Java/activeweb/pom.xml index e3f9f0c430d..25171d2d172 100644 --- a/frameworks/Java/activeweb/pom.xml +++ b/frameworks/Java/activeweb/pom.xml @@ -120,7 +120,7 @@ com.fasterxml.jackson.core jackson-databind - 2.13.4.2 + 2.16.0 diff --git a/frameworks/Java/bayou/pom.xml b/frameworks/Java/bayou/pom.xml index feee2d76073..638a06778e2 100644 --- a/frameworks/Java/bayou/pom.xml +++ b/frameworks/Java/bayou/pom.xml @@ -33,7 +33,7 @@ com.fasterxml.jackson.core jackson-databind - 2.13.4.2 + 2.16.0 diff --git a/frameworks/Java/grizzly/pom.xml b/frameworks/Java/grizzly/pom.xml index 0cf5f082fd4..527560610b6 100644 --- a/frameworks/Java/grizzly/pom.xml +++ b/frameworks/Java/grizzly/pom.xml @@ -72,7 +72,7 @@ com.fasterxml.jackson.core jackson-databind - 2.13.4.2 + 2.16.0 diff --git a/frameworks/Java/httpserver/pom.xml b/frameworks/Java/httpserver/pom.xml index 4526fb528bf..30577d8801f 100644 --- a/frameworks/Java/httpserver/pom.xml +++ b/frameworks/Java/httpserver/pom.xml @@ -18,7 +18,7 @@ com.fasterxml.jackson.core jackson-databind - 2.13.4.2 + 2.16.0 com.fasterxml.jackson.module diff --git a/frameworks/Java/jlhttp/pom.xml b/frameworks/Java/jlhttp/pom.xml index 5f12f34226c..af63382cc2b 100644 --- a/frameworks/Java/jlhttp/pom.xml +++ b/frameworks/Java/jlhttp/pom.xml @@ -24,7 +24,7 @@ com.fasterxml.jackson.core jackson-databind - 2.13.4.2 + 2.16.0 com.fasterxml.jackson.module diff --git a/frameworks/Java/microhttp/pom.xml b/frameworks/Java/microhttp/pom.xml index 75501b02275..6e4ea1d91eb 100644 --- a/frameworks/Java/microhttp/pom.xml +++ b/frameworks/Java/microhttp/pom.xml @@ -29,7 +29,7 @@ com.fasterxml.jackson.core jackson-databind - 2.13.4.2 + 2.16.0 mysql diff --git a/frameworks/Java/nanohttpd/pom.xml b/frameworks/Java/nanohttpd/pom.xml index 5ce138edc23..10538727775 100644 --- a/frameworks/Java/nanohttpd/pom.xml +++ b/frameworks/Java/nanohttpd/pom.xml @@ -23,7 +23,7 @@ com.fasterxml.jackson.core jackson-databind - 2.13.4.2 + 2.16.0 com.fasterxml.jackson.module diff --git a/frameworks/Java/servlet/pom.xml b/frameworks/Java/servlet/pom.xml index 052ca85e38e..6f08f65c22a 100644 --- a/frameworks/Java/servlet/pom.xml +++ b/frameworks/Java/servlet/pom.xml @@ -13,7 +13,7 @@ 11 11 1.2.3.Final - 2.13.4.2 + 2.16.0 src/main/webapp/WEB-INF/web.xml diff --git a/frameworks/Java/servlet3/pom.xml b/frameworks/Java/servlet3/pom.xml index d8db7acde68..d48a9d90723 100644 --- a/frameworks/Java/servlet3/pom.xml +++ b/frameworks/Java/servlet3/pom.xml @@ -80,7 +80,7 @@ com.fasterxml.jackson.core jackson-databind - 2.13.4.2 + 2.16.0 diff --git a/frameworks/Java/tapestry/pom.xml b/frameworks/Java/tapestry/pom.xml index f76174d8b7e..e764bc2860d 100644 --- a/frameworks/Java/tapestry/pom.xml +++ b/frameworks/Java/tapestry/pom.xml @@ -95,7 +95,7 @@ of testing facilities designed for use with TestNG (http://testng.org/), so it's com.fasterxml.jackson.core jackson-databind - 2.13.4.2 + 2.16.0 org.glassfish.jaxb diff --git a/frameworks/Java/undertow-jersey/pom.xml b/frameworks/Java/undertow-jersey/pom.xml index af553eea552..3dcc90d2d81 100644 --- a/frameworks/Java/undertow-jersey/pom.xml +++ b/frameworks/Java/undertow-jersey/pom.xml @@ -145,7 +145,7 @@ com.fasterxml.jackson.core jackson-databind - 2.13.4.2 + 2.16.0 com.fasterxml.jackson.module diff --git a/frameworks/Java/undertow/pom.xml b/frameworks/Java/undertow/pom.xml index 133d1ce186c..3bdce648fb3 100644 --- a/frameworks/Java/undertow/pom.xml +++ b/frameworks/Java/undertow/pom.xml @@ -14,7 +14,7 @@ 18 UTF-8 5.0.1 - 2.13.4.2 + 2.16.0 3.10.1 3.3.0 3.2.2 diff --git a/frameworks/Prolog/tuProlog/pom.xml b/frameworks/Prolog/tuProlog/pom.xml index c707a7e3221..dd86c6a45a2 100644 --- a/frameworks/Prolog/tuProlog/pom.xml +++ b/frameworks/Prolog/tuProlog/pom.xml @@ -13,7 +13,7 @@ 16 0.18.2 4.3.8 - 2.13.4.2 + 2.16.0 From 9c4f41a1b9a948d1a94a7dad4653a8f56d0b1963 Mon Sep 17 00:00:00 2001 From: Artur Date: Mon, 17 Mar 2025 17:38:08 +0100 Subject: [PATCH 13/39] feat: begone 60s wait time (#9240) --- Dockerfile | 1 + toolset/benchmark/benchmarker.py | 16 ++++++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4325f036734..28de4fb3415 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,6 +13,7 @@ RUN apt-get -yqq update && \ gcc \ git-core \ gosu \ + iproute2 \ # Needed for mysqlclient libmysqlclient-dev \ libpq-dev \ diff --git a/toolset/benchmark/benchmarker.py b/toolset/benchmark/benchmarker.py index 8b5ce49d65b..edf66ce24d4 100644 --- a/toolset/benchmark/benchmarker.py +++ b/toolset/benchmark/benchmarker.py @@ -37,8 +37,6 @@ def __init__(self, config): self.results = Results(self) self.docker_helper = DockerHelper(self) - self.last_test = False - ########################################################################################## # Public methods ########################################################################################## @@ -64,8 +62,6 @@ def run(self): with open(os.path.join(self.results.directory, 'benchmark.log'), 'w') as benchmark_log: for test in self.tests: - if self.tests.index(test) + 1 == len(self.tests): - self.last_test = True log("Running Test: %s" % test.name, border='-') with self.config.quiet_out.enable(): if not self.__run_test(test, benchmark_log): @@ -101,13 +97,17 @@ def __exit_test(self, success, prefix, file, message=None): color=Fore.RED if success else '') self.time_logger.log_test_end(log_prefix=prefix, file=file) if self.config.mode == "benchmark": - # Sleep for 60 seconds to ensure all host connects are closed - log("Clean up: Sleep 60 seconds...", prefix=prefix, file=file) - time.sleep(60) + total_tcp_sockets = subprocess.check_output("ss -s | grep TCP: | awk '{print $2}'", shell=True, text=True) + log("Total TCP sockets: " + total_tcp_sockets, prefix=prefix, file=file) + + if int(total_tcp_sockets) > 5000: + # Sleep for 60 seconds to ensure all host connects are closed + log("Clean up: Sleep 60 seconds...", prefix=prefix, file=file) + time.sleep(60) + # After benchmarks are complete for all test types in this test, # let's clean up leftover test images (techempower/tfb.test.test-name) self.docker_helper.clean() - return success def __run_test(self, test, benchmark_log): From b30765dde4dc78b19500d59c32f2f744cf08aaa3 Mon Sep 17 00:00:00 2001 From: softjapan Date: Tue, 18 Mar 2025 02:21:46 +0900 Subject: [PATCH 14/39] Refactor User and Group Creation in Dockerfile for Improved Efficiency and Simplicity (#9490) refactors the user and group creation process in the Dockerfile to address inefficiencies, reduce redundancy, and enhance simplicity. --- Dockerfile | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index 28de4fb3415..0e60a78d94c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -44,17 +44,12 @@ RUN curl -LSs "https://github.com/scottchiefbaker/dool/archive/${DOOL_VERSION}.t tar --strip-components=1 -xz && \ ./install.py -# Check if the group ID is already created +# create group and user ARG GROUP_ID -RUN if ! getent group "$GROUP_ID"; then \ - addgroup --gid "$GROUP_ID" user; \ - fi - -# Check if the user ID is already created ARG USER_ID -RUN if ! getent passwd "$USER_ID"; then \ - adduser --disabled-password --gecos '' --gid "$GROUP_ID" --uid "$USER_ID" user; \ - fi + +RUN groupadd -g "$GROUP_ID" user || true && \ + useradd -m -u "$USER_ID" -g "$GROUP_ID" -s /bin/bash user || true ENV FWROOT=/FrameworkBenchmarks USER_ID="$USER_ID" ENV PYTHONPATH="$FWROOT" From 2661d4b75e4fb9d8f4583104264487d1e7947b1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Ros?= Date: Mon, 17 Mar 2025 11:44:27 -0700 Subject: [PATCH 15/39] Update ASP.NET Core metadata (#9639) * Update ASP.NET metadata Would it be possible to also update the calculation using `ASP.NET Core [Paltform]` instead of the previous `ASP.NET Core`? * Fix typeos * Remove updates for MVC * Add maintainers to benchmark_config.json --- .../CSharp/aspnetcore/benchmark_config.json | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/frameworks/CSharp/aspnetcore/benchmark_config.json b/frameworks/CSharp/aspnetcore/benchmark_config.json index 831a9f27d81..eb56fddfb57 100644 --- a/frameworks/CSharp/aspnetcore/benchmark_config.json +++ b/frameworks/CSharp/aspnetcore/benchmark_config.json @@ -1,5 +1,6 @@ { "framework": "aspnetcore", + "maintainers": ["DamianEdwards", "sebastienros"], "tests": [ { "default": { @@ -14,7 +15,7 @@ "approach": "Realistic", "classification": "Platform", "database": "Postgres", - "framework": "ASP.NET Core", + "framework": "ASP.NET Core [Platform]", "language": "C#", "orm": "Raw", "platform": ".NET", @@ -22,7 +23,7 @@ "webserver": "Kestrel", "os": "Linux", "database_os": "Linux", - "display_name": "ASP.NET Core [Platform, Pg]", + "display_name": "ASP.NET Core [Platform]", "notes": "" }, "aot": { @@ -37,7 +38,7 @@ "approach": "Realistic", "classification": "Platform", "database": "Postgres", - "framework": "ASP.NET Core", + "framework": "ASP.NET Core [Platform]", "language": "C#", "orm": "Raw", "platform": ".NET", @@ -45,7 +46,7 @@ "webserver": "Kestrel", "os": "Linux", "database_os": "Linux", - "display_name": "ASP.NET Core [Platform, Pg, AOT]", + "display_name": "ASP.NET Core [Platform, AOT]", "notes": "" }, "minimal": { @@ -67,7 +68,7 @@ "webserver": "Kestrel", "os": "Linux", "database_os": "Linux", - "display_name": "ASP.NET Core [Minimal APIs, Pg, Dapper]", + "display_name": "ASP.NET Core [Minimal APIs]", "notes": "", "versus": "aspnetcore" }, @@ -89,7 +90,7 @@ "webserver": "Kestrel", "os": "Linux", "database_os": "Linux", - "display_name": "ASP.NET Core [MVC, Pg, EF]", + "display_name": "ASP.NET Core [MVC]", "notes": "", "versus": "aspnetcore" }, @@ -103,7 +104,7 @@ "approach": "Realistic", "classification": "Platform", "database": "MySQL", - "framework": "ASP.NET Core", + "framework": "ASP.NET Core [Platform]", "language": "C#", "orm": "Raw", "platform": ".NET", @@ -111,8 +112,9 @@ "webserver": "Kestrel", "os": "Linux", "database_os": "Linux", - "display_name": "ASP.NET Core [Platform, My]", - "notes": "" + "display_name": "ASP.NET Core [Platform, MySQL]", + "notes": "", + "versus": "aspnetcore" } } ] From a807ce89a74b5b530c72a4e2bdd6e4c79693bdbf Mon Sep 17 00:00:00 2001 From: Petrik de Heus Date: Mon, 17 Mar 2025 19:45:39 +0100 Subject: [PATCH 16/39] [ruby/padrino] Don't hardcode number of workers to 8 for Puma (#9681) Use autotune instead as the server can handle a lot more than 8 threads. --- frameworks/Ruby/padrino/config/auto_tune.rb | 2 +- frameworks/Ruby/padrino/padrino.dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/frameworks/Ruby/padrino/config/auto_tune.rb b/frameworks/Ruby/padrino/config/auto_tune.rb index 4544231b9d2..54ae1e08731 100644 --- a/frameworks/Ruby/padrino/config/auto_tune.rb +++ b/frameworks/Ruby/padrino/config/auto_tune.rb @@ -9,7 +9,7 @@ MIN_WORKERS = 2 MAX_WORKERS_PER_VCPU = 1.25 # virtual/logical MIN_THREADS_PER_WORKER = 1 -MAX_THREADS = Integer(ENV['MAX_CONCURRENCY'] || 8) +MAX_THREADS = Integer(ENV['MAX_CONCURRENCY'] || 256) def meminfo(arg) File.open('/proc/meminfo') do |f| diff --git a/frameworks/Ruby/padrino/padrino.dockerfile b/frameworks/Ruby/padrino/padrino.dockerfile index b35254eb3e7..eb3bf6f68de 100644 --- a/frameworks/Ruby/padrino/padrino.dockerfile +++ b/frameworks/Ruby/padrino/padrino.dockerfile @@ -16,4 +16,4 @@ EXPOSE 8080 ENV RUBY_YJIT_ENABLE=1 -CMD bundle exec puma -C config/puma.rb -w 8 --preload +CMD bundle exec puma -C config/puma.rb From 05ad8ef053aa57109615dfd1c162fd472dbdcb85 Mon Sep 17 00:00:00 2001 From: Marc Scholten Date: Mon, 17 Mar 2025 13:32:20 -0700 Subject: [PATCH 17/39] ihp: update to v1.3.1 (#9594) * ihp: update to v1.3.1 * ihp: use specific nixpkgs commit to avoid out of memory on github actions --- frameworks/Haskell/ihp/ihp.dockerfile | 10 +- frameworks/Haskell/ihp/src/.envrc | 16 + frameworks/Haskell/ihp/src/.ghci | 7 +- frameworks/Haskell/ihp/src/.gitignore | 6 +- frameworks/Haskell/ihp/src/Makefile | 10 +- frameworks/Haskell/ihp/src/default.nix | 21 - frameworks/Haskell/ihp/src/flake.lock | 1247 ++++++++++++++++++++++++ frameworks/Haskell/ihp/src/flake.nix | 37 + frameworks/Haskell/ihp/src/start | 17 - 9 files changed, 1316 insertions(+), 55 deletions(-) create mode 100644 frameworks/Haskell/ihp/src/.envrc delete mode 100644 frameworks/Haskell/ihp/src/default.nix create mode 100644 frameworks/Haskell/ihp/src/flake.lock create mode 100644 frameworks/Haskell/ihp/src/flake.nix delete mode 100755 frameworks/Haskell/ihp/src/start diff --git a/frameworks/Haskell/ihp/ihp.dockerfile b/frameworks/Haskell/ihp/ihp.dockerfile index cc1f35a428c..f01fa42dd2f 100644 --- a/frameworks/Haskell/ihp/ihp.dockerfile +++ b/frameworks/Haskell/ihp/ihp.dockerfile @@ -1,14 +1,14 @@ FROM nixos/nix -COPY ./src /ihp -WORKDIR /ihp - # Add build dependencies -RUN nix-env -i cachix +RUN nix-env -f https://github.com/NixOS/nixpkgs/archive/54b4bb956f9891b872904abdb632cea85a033ff2.tar.gz -iA cachix RUN cachix use digitallyinduced +COPY ./src /ihp +WORKDIR /ihp + # Build -RUN nix-build -j auto --cores 0 +RUN nix --extra-experimental-features "nix-command flakes" build -j auto --cores 0 .#optimized-prod-server # Setup ENV DATABASE_URL=postgres://benchmarkdbuser:benchmarkdbpass@tfb-database:5432/hello_world diff --git a/frameworks/Haskell/ihp/src/.envrc b/frameworks/Haskell/ihp/src/.envrc new file mode 100644 index 00000000000..33b7d186799 --- /dev/null +++ b/frameworks/Haskell/ihp/src/.envrc @@ -0,0 +1,16 @@ +if ! has nix_direnv_version || ! nix_direnv_version 2.3.0; then + source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.3.0/direnvrc" "sha256-Dmd+j63L84wuzgyjITIfSxSD57Tx7v51DMxVZOsiUD8=" +fi + +use flake . --impure --accept-flake-config + +# Include .env file if it exists locally. Use the .env file to load env vars that you don't want to commit to git +if [ -f .env ] +then + set -o allexport + source .env + set +o allexport +fi +# Add your env vars here +# +# E.g. export AWS_ACCESS_KEY_ID="XXXXX" \ No newline at end of file diff --git a/frameworks/Haskell/ihp/src/.ghci b/frameworks/Haskell/ihp/src/.ghci index aceca281d6c..48ee12a2ed3 100644 --- a/frameworks/Haskell/ihp/src/.ghci +++ b/frameworks/Haskell/ihp/src/.ghci @@ -1,3 +1,4 @@ -import Prelude -:def source readFile -:source build/ihp-lib/applicationGhciConfig +:set -XNoImplicitPrelude +:def loadFromIHP \file -> (System.Environment.getEnv "IHP_LIB") >>= (\ihpLib -> readFile (ihpLib <> "/" <> file)) +:loadFromIHP applicationGhciConfig +import IHP.Prelude \ No newline at end of file diff --git a/frameworks/Haskell/ihp/src/.gitignore b/frameworks/Haskell/ihp/src/.gitignore index d27ddd2281d..6bb8d1fba18 100644 --- a/frameworks/Haskell/ihp/src/.gitignore +++ b/frameworks/Haskell/ihp/src/.gitignore @@ -1,5 +1,4 @@ .DS_Store -.envrc .idea tmp result @@ -17,3 +16,8 @@ gen del static/prod.* Config/client_session_key.aes + +.devenv* +devenv.local.nix +.direnv +.env \ No newline at end of file diff --git a/frameworks/Haskell/ihp/src/Makefile b/frameworks/Haskell/ihp/src/Makefile index eb103029c90..4482e99a6c6 100644 --- a/frameworks/Haskell/ihp/src/Makefile +++ b/frameworks/Haskell/ihp/src/Makefile @@ -1,11 +1,3 @@ -ifneq ($(wildcard IHP/.*),) -IHP = IHP/lib/IHP -else -IHP = $(shell dirname $$(which RunDevServer))/../lib/IHP -endif - -include ${IHP}/Makefile.dist - CSS_FILES += ${IHP}/static/vendor/bootstrap.min.css CSS_FILES += ${IHP}/static/vendor/flatpickr.min.css @@ -19,3 +11,5 @@ JS_FILES += ${IHP}/static/vendor/morphdom-umd.min.js JS_FILES += ${IHP}/static/vendor/turbolinks.js JS_FILES += ${IHP}/static/vendor/turbolinksInstantClick.js JS_FILES += ${IHP}/static/vendor/turbolinksMorphdom.js + +include ${IHP}/Makefile.dist \ No newline at end of file diff --git a/frameworks/Haskell/ihp/src/default.nix b/frameworks/Haskell/ihp/src/default.nix deleted file mode 100644 index 1bf1062066e..00000000000 --- a/frameworks/Haskell/ihp/src/default.nix +++ /dev/null @@ -1,21 +0,0 @@ -let - ihp = builtins.fetchGit { - url = "https://github.com/digitallyinduced/ihp.git"; - ref = "refs/tags/v1.0.1"; - }; - haskellEnv = import "${ihp}/NixSupport/default.nix" { - ihp = ihp; - haskellDeps = p: with p; [ - base - wai - text - p.ihp - ]; - otherDeps = p: with p; [ - # Native dependencies, e.g. imagemagick - ]; - projectPath = ./.; - optimized = true; - }; -in - haskellEnv diff --git a/frameworks/Haskell/ihp/src/flake.lock b/frameworks/Haskell/ihp/src/flake.lock new file mode 100644 index 00000000000..8529cf94aae --- /dev/null +++ b/frameworks/Haskell/ihp/src/flake.lock @@ -0,0 +1,1247 @@ +{ + "nodes": { + "cachix": { + "inputs": { + "devenv": "devenv_2", + "flake-compat": [ + "ihp", + "devenv", + "flake-compat" + ], + "nixpkgs": [ + "ihp", + "devenv", + "nixpkgs" + ], + "pre-commit-hooks": [ + "ihp", + "devenv", + "pre-commit-hooks" + ] + }, + "locked": { + "lastModified": 1712055811, + "narHash": "sha256-7FcfMm5A/f02yyzuavJe06zLa9hcMHsagE28ADcmQvk=", + "owner": "cachix", + "repo": "cachix", + "rev": "02e38da89851ec7fec3356a5c04bc8349cae0e30", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "cachix", + "type": "github" + } + }, + "devenv": { + "inputs": { + "cachix": "cachix", + "flake-compat": "flake-compat_2", + "nix": "nix_2", + "nixpkgs": [ + "ihp", + "nixpkgs" + ], + "pre-commit-hooks": "pre-commit-hooks" + }, + "locked": { + "lastModified": 1714390914, + "narHash": "sha256-W5DFIifCjGYJXJzLU3RpqBeqes4zrf0Sr/6rwzTygPU=", + "owner": "cachix", + "repo": "devenv", + "rev": "34e6461fd76b5f51ad5f8214f5cf22c4cd7a196e", + "type": "github" + }, + "original": { + "owner": "cachix", + "ref": "refs/tags/v1.0.5", + "repo": "devenv", + "type": "github" + } + }, + "devenv_2": { + "inputs": { + "flake-compat": [ + "ihp", + "devenv", + "cachix", + "flake-compat" + ], + "nix": "nix", + "nixpkgs": "nixpkgs", + "poetry2nix": "poetry2nix", + "pre-commit-hooks": [ + "ihp", + "devenv", + "cachix", + "pre-commit-hooks" + ] + }, + "locked": { + "lastModified": 1708704632, + "narHash": "sha256-w+dOIW60FKMaHI1q5714CSibk99JfYxm0CzTinYWr+Q=", + "owner": "cachix", + "repo": "devenv", + "rev": "2ee4450b0f4b95a1b90f2eb5ffea98b90e48c196", + "type": "github" + }, + "original": { + "owner": "cachix", + "ref": "python-rewrite", + "repo": "devenv", + "type": "github" + } + }, + "devenv_3": { + "inputs": { + "flake-compat": "flake-compat_3", + "nix": "nix_3", + "nixpkgs": [ + "ihp", + "ihp-boilerplate", + "ihp", + "nixpkgs" + ], + "pre-commit-hooks": "pre-commit-hooks_2" + }, + "locked": { + "lastModified": 1694422554, + "narHash": "sha256-s5NTPzT66yIMmau+ZGP7q9z4NjgceDETL4xZ6HJ/TBg=", + "owner": "cachix", + "repo": "devenv", + "rev": "63d20fe09aa09060ea9ec9bb6d582c025402ba15", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "devenv", + "type": "github" + } + }, + "devenv_4": { + "inputs": { + "flake-compat": "flake-compat_4", + "nix": "nix_4", + "nixpkgs": [ + "ihp", + "ihp-boilerplate", + "ihp", + "ihp-boilerplate", + "ihp", + "nixpkgs" + ], + "pre-commit-hooks": "pre-commit-hooks_3" + }, + "locked": { + "lastModified": 1686054274, + "narHash": "sha256-93aebyN7EMmeFFXisFIvp28UEbrozu79vd3pKPjvNR0=", + "owner": "cachix", + "repo": "devenv", + "rev": "c51a56bac8853c019241fe8d821c0a0d82422835", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "devenv", + "type": "github" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-compat_2": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-compat_3": { + "flake": false, + "locked": { + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-compat_4": { + "flake": false, + "locked": { + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": [ + "ihp", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1714641030, + "narHash": "sha256-yzcRNDoyVP7+SCNX0wmuDju1NUCt8Dz9+lyUXEI0dbI=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "e5d10a24b66c3ea8f150e47dfdb0416ab7c3390e", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_2": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1693611461, + "narHash": "sha256-aPODl8vAgGQ0ZYFIRisxYG5MOGSkIczvu2Cd8Gb9+1Y=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "7f53fdb7bdc5bb237da7fefef12d099e4fd611ca", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_3": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib_2" + }, + "locked": { + "lastModified": 1685662779, + "narHash": "sha256-cKDDciXGpMEjP1n6HlzKinN0H+oLmNpgeCTzYnsA2po=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "71fb97f0d875fd4de4994dfb849f2c75e17eb6c3", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1689068808, + "narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_2": { + "inputs": { + "systems": "systems_2" + }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_3": { + "inputs": { + "systems": "systems_3" + }, + "locked": { + "lastModified": 1685518550, + "narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_4": { + "locked": { + "lastModified": 1667395993, + "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "ihp", + "devenv", + "pre-commit-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "gitignore_2": { + "inputs": { + "nixpkgs": [ + "ihp", + "ihp-boilerplate", + "ihp", + "devenv", + "pre-commit-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1660459072, + "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "gitignore_3": { + "inputs": { + "nixpkgs": [ + "ihp", + "ihp-boilerplate", + "ihp", + "ihp-boilerplate", + "ihp", + "devenv", + "pre-commit-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1660459072, + "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "ihp": { + "inputs": { + "devenv": "devenv", + "flake-parts": "flake-parts", + "ihp-boilerplate": "ihp-boilerplate", + "nix-filter": "nix-filter_2", + "nixpkgs": "nixpkgs_4", + "systems": "systems_6" + }, + "locked": { + "lastModified": 1739859908, + "narHash": "sha256-UjXDYUmRpUbx9xNi6gA+dh4HDEvB67TvHovm79SRKHE=", + "owner": "digitallyinduced", + "repo": "ihp", + "rev": "4df99962603bf53514d5a645ccc5a596e8c57243", + "type": "github" + }, + "original": { + "owner": "digitallyinduced", + "ref": "v1.3.1", + "repo": "ihp", + "type": "github" + } + }, + "ihp-boilerplate": { + "inputs": { + "devenv": [ + "ihp", + "ihp-boilerplate", + "ihp", + "devenv" + ], + "flake-parts": [ + "ihp", + "ihp-boilerplate", + "ihp", + "flake-parts" + ], + "ihp": "ihp_2", + "nixpkgs": [ + "ihp", + "ihp-boilerplate", + "ihp", + "nixpkgs" + ], + "systems": [ + "ihp", + "ihp-boilerplate", + "ihp", + "systems" + ] + }, + "locked": { + "lastModified": 1710175252, + "narHash": "sha256-QIFqo64U69uUGJ7pgBr37T3yAKK0n1ueqagKmnm+XWw=", + "owner": "digitallyinduced", + "repo": "ihp-boilerplate", + "rev": "323591d6135f7a89b5b4e518d5d420cd5b046fe2", + "type": "github" + }, + "original": { + "owner": "digitallyinduced", + "repo": "ihp-boilerplate", + "type": "github" + } + }, + "ihp-boilerplate_2": { + "inputs": { + "devenv": [ + "ihp", + "ihp-boilerplate", + "ihp", + "ihp-boilerplate", + "ihp", + "devenv" + ], + "flake-parts": [ + "ihp", + "ihp-boilerplate", + "ihp", + "ihp-boilerplate", + "ihp", + "flake-parts" + ], + "ihp": "ihp_3", + "nixpkgs": [ + "ihp", + "ihp-boilerplate", + "ihp", + "ihp-boilerplate", + "ihp", + "nixpkgs" + ], + "systems": [ + "ihp", + "ihp-boilerplate", + "ihp", + "ihp-boilerplate", + "ihp", + "systems" + ] + }, + "locked": { + "lastModified": 1689954789, + "narHash": "sha256-RsgD1YGSlx+K/GkTspOdg/tz47PyZZDc66PzfFZvqBk=", + "owner": "digitallyinduced", + "repo": "ihp-boilerplate", + "rev": "832d1a5aed4dc3625486c82b06a1d07024267680", + "type": "github" + }, + "original": { + "owner": "digitallyinduced", + "repo": "ihp-boilerplate", + "type": "github" + } + }, + "ihp-boilerplate_3": { + "flake": false, + "locked": { + "lastModified": 1686165507, + "narHash": "sha256-ZaP8GfqjZDnMayPcvWxEqnZmRs4ixf5O5d1Ba867m4c=", + "owner": "digitallyinduced", + "repo": "ihp-boilerplate", + "rev": "ff63ce46b6fb68f1b8b3cdb0bdd6749f7ef1df93", + "type": "github" + }, + "original": { + "owner": "digitallyinduced", + "ref": "nicolas/flake", + "repo": "ihp-boilerplate", + "type": "github" + } + }, + "ihp_2": { + "inputs": { + "devenv": "devenv_3", + "flake-parts": "flake-parts_2", + "ihp-boilerplate": "ihp-boilerplate_2", + "nix-filter": "nix-filter", + "nixpkgs": "nixpkgs_3", + "systems": "systems_5" + }, + "locked": { + "lastModified": 1700013490, + "narHash": "sha256-oQz7ZBrHe6WwYMwnxxUgnYM55CuH5Oxjz6mrLnYbB7U=", + "owner": "digitallyinduced", + "repo": "ihp", + "rev": "d59a65d71943cb506eee3ad6255f017963237359", + "type": "github" + }, + "original": { + "owner": "digitallyinduced", + "ref": "v1.2", + "repo": "ihp", + "type": "github" + } + }, + "ihp_3": { + "inputs": { + "devenv": "devenv_4", + "flake-parts": "flake-parts_3", + "ihp-boilerplate": "ihp-boilerplate_3", + "nixpkgs": "nixpkgs_2", + "systems": "systems_4" + }, + "locked": { + "lastModified": 1689949405, + "narHash": "sha256-o0ZSDaDFgwbXqozHfcXKxW4FeF7JqaGprAh6r7NhvhE=", + "owner": "digitallyinduced", + "repo": "ihp", + "rev": "e6c6eaf1d089423a03e586cd25d1eda39f5a6b11", + "type": "github" + }, + "original": { + "owner": "digitallyinduced", + "ref": "v1.1", + "repo": "ihp", + "type": "github" + } + }, + "lowdown-src": { + "flake": false, + "locked": { + "lastModified": 1633514407, + "narHash": "sha256-Dw32tiMjdK9t3ETl5fzGrutQTzh2rufgZV4A/BbxuD4=", + "owner": "kristapsdz", + "repo": "lowdown", + "rev": "d2c2b44ff6c27b936ec27358a2653caaef8f73b8", + "type": "github" + }, + "original": { + "owner": "kristapsdz", + "repo": "lowdown", + "type": "github" + } + }, + "lowdown-src_2": { + "flake": false, + "locked": { + "lastModified": 1633514407, + "narHash": "sha256-Dw32tiMjdK9t3ETl5fzGrutQTzh2rufgZV4A/BbxuD4=", + "owner": "kristapsdz", + "repo": "lowdown", + "rev": "d2c2b44ff6c27b936ec27358a2653caaef8f73b8", + "type": "github" + }, + "original": { + "owner": "kristapsdz", + "repo": "lowdown", + "type": "github" + } + }, + "nix": { + "inputs": { + "flake-compat": "flake-compat", + "nixpkgs": [ + "ihp", + "devenv", + "cachix", + "devenv", + "nixpkgs" + ], + "nixpkgs-regression": "nixpkgs-regression" + }, + "locked": { + "lastModified": 1712911606, + "narHash": "sha256-BGvBhepCufsjcUkXnEEXhEVjwdJAwPglCC2+bInc794=", + "owner": "domenkozar", + "repo": "nix", + "rev": "b24a9318ea3f3600c1e24b4a00691ee912d4de12", + "type": "github" + }, + "original": { + "owner": "domenkozar", + "ref": "devenv-2.21", + "repo": "nix", + "type": "github" + } + }, + "nix-filter": { + "locked": { + "lastModified": 1694434370, + "narHash": "sha256-7yfdTR4mCvWZ39Q6HUcsa18tr0mg+fJZSaHE/63rwoo=", + "owner": "numtide", + "repo": "nix-filter", + "rev": "d6381c442f79f2f1fdfde00521c3d15d6c21218e", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "nix-filter", + "type": "github" + } + }, + "nix-filter_2": { + "locked": { + "lastModified": 1710156097, + "narHash": "sha256-1Wvk8UP7PXdf8bCCaEoMnOT1qe5/Duqgj+rL8sRQsSM=", + "owner": "numtide", + "repo": "nix-filter", + "rev": "3342559a24e85fc164b295c3444e8a139924675b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "nix-filter", + "type": "github" + } + }, + "nix-github-actions": { + "inputs": { + "nixpkgs": [ + "ihp", + "devenv", + "cachix", + "devenv", + "poetry2nix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1688870561, + "narHash": "sha256-4UYkifnPEw1nAzqqPOTL2MvWtm3sNGw1UTYTalkTcGY=", + "owner": "nix-community", + "repo": "nix-github-actions", + "rev": "165b1650b753316aa7f1787f3005a8d2da0f5301", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nix-github-actions", + "type": "github" + } + }, + "nix_2": { + "inputs": { + "flake-compat": [ + "ihp", + "devenv", + "flake-compat" + ], + "nixpkgs": [ + "ihp", + "devenv", + "nixpkgs" + ], + "nixpkgs-regression": "nixpkgs-regression_2" + }, + "locked": { + "lastModified": 1718382440, + "narHash": "sha256-aUqR+pxqKTKLtj8HAI5sbdT6C1VgtHDcrKjmn+wWkXQ=", + "owner": "domenkozar", + "repo": "nix", + "rev": "31b9700169d9bba693c379d59d587cd20bf115a6", + "type": "github" + }, + "original": { + "owner": "domenkozar", + "ref": "devenv-2.21", + "repo": "nix", + "type": "github" + } + }, + "nix_3": { + "inputs": { + "lowdown-src": "lowdown-src", + "nixpkgs": [ + "ihp", + "ihp-boilerplate", + "ihp", + "devenv", + "nixpkgs" + ], + "nixpkgs-regression": "nixpkgs-regression_3" + }, + "locked": { + "lastModified": 1676545802, + "narHash": "sha256-EK4rZ+Hd5hsvXnzSzk2ikhStJnD63odF7SzsQ8CuSPU=", + "owner": "domenkozar", + "repo": "nix", + "rev": "7c91803598ffbcfe4a55c44ac6d49b2cf07a527f", + "type": "github" + }, + "original": { + "owner": "domenkozar", + "ref": "relaxed-flakes", + "repo": "nix", + "type": "github" + } + }, + "nix_4": { + "inputs": { + "lowdown-src": "lowdown-src_2", + "nixpkgs": [ + "ihp", + "ihp-boilerplate", + "ihp", + "ihp-boilerplate", + "ihp", + "devenv", + "nixpkgs" + ], + "nixpkgs-regression": "nixpkgs-regression_4" + }, + "locked": { + "lastModified": 1676545802, + "narHash": "sha256-EK4rZ+Hd5hsvXnzSzk2ikhStJnD63odF7SzsQ8CuSPU=", + "owner": "domenkozar", + "repo": "nix", + "rev": "7c91803598ffbcfe4a55c44ac6d49b2cf07a527f", + "type": "github" + }, + "original": { + "owner": "domenkozar", + "ref": "relaxed-flakes", + "repo": "nix", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1692808169, + "narHash": "sha256-x9Opq06rIiwdwGeK2Ykj69dNc2IvUH1fY55Wm7atwrE=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "9201b5ff357e781bf014d0330d18555695df7ba8", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib": { + "locked": { + "dir": "lib", + "lastModified": 1693471703, + "narHash": "sha256-0l03ZBL8P1P6z8MaSDS/MvuU8E75rVxe5eE1N6gxeTo=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "3e52e76b70d5508f3cec70b882a29199f4d1ee85", + "type": "github" + }, + "original": { + "dir": "lib", + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-lib_2": { + "locked": { + "dir": "lib", + "lastModified": 1685564631, + "narHash": "sha256-8ywr3AkblY4++3lIVxmrWZFzac7+f32ZEhH/A8pNscI=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "4f53efe34b3a8877ac923b9350c874e3dcd5dc0a", + "type": "github" + }, + "original": { + "dir": "lib", + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-regression": { + "locked": { + "lastModified": 1643052045, + "narHash": "sha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", + "type": "github" + } + }, + "nixpkgs-regression_2": { + "locked": { + "lastModified": 1643052045, + "narHash": "sha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", + "type": "github" + } + }, + "nixpkgs-regression_3": { + "locked": { + "lastModified": 1643052045, + "narHash": "sha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", + "type": "github" + } + }, + "nixpkgs-regression_4": { + "locked": { + "lastModified": 1643052045, + "narHash": "sha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2", + "type": "github" + } + }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1710695816, + "narHash": "sha256-3Eh7fhEID17pv9ZxrPwCLfqXnYP006RKzSs0JptsN84=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "614b4613980a522ba49f0d194531beddbb7220d3", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-23.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-stable_2": { + "locked": { + "lastModified": 1685801374, + "narHash": "sha256-otaSUoFEMM+LjBI1XL/xGB5ao6IwnZOXc47qhIgJe8U=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "c37ca420157f4abc31e26f436c1145f8951ff373", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-23.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-stable_3": { + "locked": { + "lastModified": 1678872516, + "narHash": "sha256-/E1YwtMtFAu2KUQKV/1+KFuReYPANM2Rzehk84VxVoc=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "9b8e5abb18324c7fe9f07cb100c3cd4a29cda8b8", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-22.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1681488673, + "narHash": "sha256-PmojOyePBNvbY3snYE7NAQHTLB53t7Ro+pgiJ4wPCuk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "a95ed9fe764c3ba2bf2d2fa223012c379cd6b32e", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "a95ed9fe764c3ba2bf2d2fa223012c379cd6b32e", + "type": "github" + } + }, + "nixpkgs_3": { + "locked": { + "lastModified": 1696291921, + "narHash": "sha256-isKgVAoUxuxYEuO3Q4xhbfKcZrF/+UkJtOTv0eb/W5E=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "ea0284a3da391822909be5e98a60c1e62572a7dc", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "ea0284a3da391822909be5e98a60c1e62572a7dc", + "type": "github" + } + }, + "nixpkgs_4": { + "locked": { + "lastModified": 1714864423, + "narHash": "sha256-Wx3Y6arRJD1pd3c8SnD7dfW7KWuCr/r248P/5XLaMdM=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "54b4bb956f9891b872904abdb632cea85a033ff2", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "54b4bb956f9891b872904abdb632cea85a033ff2", + "type": "github" + } + }, + "poetry2nix": { + "inputs": { + "flake-utils": "flake-utils", + "nix-github-actions": "nix-github-actions", + "nixpkgs": [ + "ihp", + "devenv", + "cachix", + "devenv", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1692876271, + "narHash": "sha256-IXfZEkI0Mal5y1jr6IRWMqK8GW2/f28xJenZIPQqkY0=", + "owner": "nix-community", + "repo": "poetry2nix", + "rev": "d5006be9c2c2417dafb2e2e5034d83fabd207ee3", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "poetry2nix", + "type": "github" + } + }, + "pre-commit-hooks": { + "inputs": { + "flake-compat": [ + "ihp", + "devenv", + "flake-compat" + ], + "flake-utils": "flake-utils_2", + "gitignore": "gitignore", + "nixpkgs": [ + "ihp", + "devenv", + "nixpkgs" + ], + "nixpkgs-stable": "nixpkgs-stable" + }, + "locked": { + "lastModified": 1713775815, + "narHash": "sha256-Wu9cdYTnGQQwtT20QQMg7jzkANKQjwBD9iccfGKkfls=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "2ac4dcbf55ed43f3be0bae15e181f08a57af24a4", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, + "pre-commit-hooks_2": { + "inputs": { + "flake-compat": [ + "ihp", + "ihp-boilerplate", + "ihp", + "devenv", + "flake-compat" + ], + "flake-utils": "flake-utils_3", + "gitignore": "gitignore_2", + "nixpkgs": [ + "ihp", + "ihp-boilerplate", + "ihp", + "devenv", + "nixpkgs" + ], + "nixpkgs-stable": "nixpkgs-stable_2" + }, + "locked": { + "lastModified": 1688056373, + "narHash": "sha256-2+SDlNRTKsgo3LBRiMUcoEUb6sDViRNQhzJquZ4koOI=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "5843cf069272d92b60c3ed9e55b7a8989c01d4c7", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, + "pre-commit-hooks_3": { + "inputs": { + "flake-compat": [ + "ihp", + "ihp-boilerplate", + "ihp", + "ihp-boilerplate", + "ihp", + "devenv", + "flake-compat" + ], + "flake-utils": "flake-utils_4", + "gitignore": "gitignore_3", + "nixpkgs": [ + "ihp", + "ihp-boilerplate", + "ihp", + "ihp-boilerplate", + "ihp", + "devenv", + "nixpkgs" + ], + "nixpkgs-stable": "nixpkgs-stable_3" + }, + "locked": { + "lastModified": 1682596858, + "narHash": "sha256-Hf9XVpqaGqe/4oDGr30W8HlsWvJXtMsEPHDqHZA6dDg=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "fb58866e20af98779017134319b5663b8215d912", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, + "root": { + "inputs": { + "devenv": [ + "ihp", + "devenv" + ], + "flake-parts": [ + "ihp", + "flake-parts" + ], + "ihp": "ihp", + "nixpkgs": [ + "ihp", + "nixpkgs" + ], + "systems": [ + "ihp", + "systems" + ] + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_3": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_4": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_5": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_6": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/frameworks/Haskell/ihp/src/flake.nix b/frameworks/Haskell/ihp/src/flake.nix new file mode 100644 index 00000000000..90f42b47ce8 --- /dev/null +++ b/frameworks/Haskell/ihp/src/flake.nix @@ -0,0 +1,37 @@ +{ + inputs = { + # Here you can adjust the IHP version of your project + # You can find new releases at https://github.com/digitallyinduced/ihp/releases + ihp.url = "github:digitallyinduced/ihp/v1.3.1"; + nixpkgs.follows = "ihp/nixpkgs"; + flake-parts.follows = "ihp/flake-parts"; + devenv.follows = "ihp/devenv"; + systems.follows = "ihp/systems"; + }; + + outputs = inputs@{ ihp, flake-parts, systems, ... }: + flake-parts.lib.mkFlake { inherit inputs; } { + + systems = import systems; + imports = [ ihp.flakeModules.default ]; + + perSystem = { pkgs, ... }: { + ihp = { + enable = true; + projectPath = ./.; + packages = with pkgs; [ + # Native dependencies, e.g. imagemagick + ]; + haskellPackages = p: with p; [ + # Haskell dependencies go here + p.ihp + cabal-install + base + wai + text + ]; + }; + }; + + }; +} \ No newline at end of file diff --git a/frameworks/Haskell/ihp/src/start b/frameworks/Haskell/ihp/src/start deleted file mode 100755 index a5642231608..00000000000 --- a/frameworks/Haskell/ihp/src/start +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env bash -# Script to start the local dev server - -set -e - -# Unless the RunDevServer binary is available, we rebuild the .envrc cache with nix-shell -# and config cachix for using our binary cache -command -v RunDevServer >/dev/null 2>&1 \ - || { echo "PATH_add $(nix-shell -j auto --cores 0 --run 'printf %q $PATH')" > .envrc; } - -# Now we have to load the PATH variable from the .envrc cache -direnv allow -eval "$(direnv hook bash)" -eval "$(direnv export bash)" - -# Finally start the dev server -RunDevServer From feca8319c5d4ca3ecf335968efaea9efec7c753e Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Tue, 18 Mar 2025 15:21:51 +0000 Subject: [PATCH 18/39] Upgrade aiohttp (#9348) * Upgrade aiohttp * Update aiohttp.dockerfile * Update aiohttp-pg-raw.dockerfile * Update aiohttp-pg-raw.dockerfile * Update main.py * Update models.py * Update frameworks/Python/aiohttp/requirements.txt * Update models.py * Update aiohttp.dockerfile * Update aiohttp-pg-raw.dockerfile * Update requirements.txt * Update requirements.txt * Update requirements.txt * Update aiohttp-pg-raw.dockerfile * Update aiohttp.dockerfile * Update main.py * Update requirements.txt * Update aiohttp-pg-raw.dockerfile * Update aiohttp.dockerfile --- .../Python/aiohttp/aiohttp-pg-raw.dockerfile | 6 +++--- frameworks/Python/aiohttp/aiohttp.dockerfile | 6 +++--- frameworks/Python/aiohttp/app/main.py | 16 +++++++++------- frameworks/Python/aiohttp/app/models.py | 14 +++++++------- frameworks/Python/aiohttp/requirements.txt | 17 ++++++++--------- 5 files changed, 30 insertions(+), 29 deletions(-) diff --git a/frameworks/Python/aiohttp/aiohttp-pg-raw.dockerfile b/frameworks/Python/aiohttp/aiohttp-pg-raw.dockerfile index ddcb349006a..f6dda6f5ef5 100644 --- a/frameworks/Python/aiohttp/aiohttp-pg-raw.dockerfile +++ b/frameworks/Python/aiohttp/aiohttp-pg-raw.dockerfile @@ -1,14 +1,14 @@ -FROM python:3.8 +FROM python:3.13 ADD ./ /aiohttp WORKDIR aiohttp -RUN pip3 install cython==0.29.23 && \ +RUN pip3 install cython==3.0.11 && \ pip3 install -r /aiohttp/requirements.txt ENV CONNECTION=RAW EXPOSE 8080 -CMD gunicorn app.gunicorn:app -c gunicorn_conf.py +CMD python3 -O -m gunicorn app.gunicorn:app -c gunicorn_conf.py diff --git a/frameworks/Python/aiohttp/aiohttp.dockerfile b/frameworks/Python/aiohttp/aiohttp.dockerfile index b817ec61264..fe1648e3ff4 100644 --- a/frameworks/Python/aiohttp/aiohttp.dockerfile +++ b/frameworks/Python/aiohttp/aiohttp.dockerfile @@ -1,14 +1,14 @@ -FROM python:3.8 +FROM python:3.13 ADD ./ /aiohttp WORKDIR aiohttp -RUN pip3 install cython==0.29.23 && \ +RUN pip3 install cython==3.0.11 && \ pip3 install -r /aiohttp/requirements.txt WORKDIR /aiohttp EXPOSE 8080 -CMD gunicorn app.gunicorn:app -c gunicorn_conf.py +CMD python3 -O -m gunicorn app.gunicorn:app -c gunicorn_conf.py diff --git a/frameworks/Python/aiohttp/app/main.py b/frameworks/Python/aiohttp/app/main.py index 087bd39f56d..30680138c33 100644 --- a/frameworks/Python/aiohttp/app/main.py +++ b/frameworks/Python/aiohttp/app/main.py @@ -4,8 +4,7 @@ import asyncpg from aiohttp import web from sqlalchemy.engine.url import URL -from sqlalchemy.ext.asyncio import AsyncSession, create_async_engine -from sqlalchemy.orm import sessionmaker +from sqlalchemy.ext.asyncio import async_sessionmaker, create_async_engine from .views import ( json, @@ -28,14 +27,15 @@ def pg_dsn(dialect=None) -> str: """ :return: DSN url suitable for sqlalchemy and aiopg. """ - return str(URL.create( + url = URL.create( database='hello_world', password=os.getenv('PGPASS', 'benchmarkdbpass'), host='tfb-database', port='5432', username=os.getenv('PGUSER', 'benchmarkdbuser'), drivername='postgresql+{}'.format(dialect) if dialect else 'postgresql', - )) + ) + return url.render_as_string(hide_password=False) async def db_ctx(app: web.Application): @@ -48,15 +48,17 @@ async def db_ctx(app: web.Application): print(f'connection pool: min size: {min_size}, max size: {max_size}, orm: {CONNECTION_ORM}') if CONNECTION_ORM: dsn = pg_dsn('asyncpg') - engine = create_async_engine(dsn, future=True, pool_size=max_size) - app['db_session'] = sessionmaker(engine, class_=AsyncSession) + engine = create_async_engine(dsn, pool_size=max_size) + app['db_session'] = async_sessionmaker(engine) else: dsn = pg_dsn() app['pg'] = await asyncpg.create_pool(dsn=dsn, min_size=min_size, max_size=max_size, loop=app.loop) yield - if not CONNECTION_ORM: + if CONNECTION_ORM: + await app['db_session'].dispose() + else: await app['pg'].close() diff --git a/frameworks/Python/aiohttp/app/models.py b/frameworks/Python/aiohttp/app/models.py index 69f9f3858a1..c614124cbe4 100644 --- a/frameworks/Python/aiohttp/app/models.py +++ b/frameworks/Python/aiohttp/app/models.py @@ -1,20 +1,20 @@ -from sqlalchemy import Column, Integer, String -from sqlalchemy.ext.declarative import declarative_base +from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column -Base = declarative_base() +class Base(DeclarativeBase): + """Base for models.""" class World(Base): __tablename__ = 'world' - id = Column(Integer, primary_key=True) - randomnumber = Column(Integer) + id: Mapped[int] = mapped_column(primary_key=True) + randomnumber: Mapped[int] sa_worlds = World.__table__ class Fortune(Base): __tablename__ = 'fortune' - id = Column(Integer, primary_key=True) - message = Column(String) + id: Mapped[int] = mapped_column(primary_key=True) + message: Mapped[str] sa_fortunes = Fortune.__table__ diff --git a/frameworks/Python/aiohttp/requirements.txt b/frameworks/Python/aiohttp/requirements.txt index 444a284f816..82efc712810 100644 --- a/frameworks/Python/aiohttp/requirements.txt +++ b/frameworks/Python/aiohttp/requirements.txt @@ -1,9 +1,8 @@ -aiohttp==3.10.2 -asyncpg==0.25.0 -cchardet==2.1.7 -gunicorn==20.1 -jinja2==3.1.4 -psycopg2==2.9.2 -SQLAlchemy==1.4.29 -ujson==5.4.0 -uvloop==0.16 +aiohttp==3.11.14 +asyncpg==0.30.0 +gunicorn==23.0.0 +jinja2==3.1.5 +psycopg2==2.9.10 +SQLAlchemy==2.0.39 +ujson==5.10.0 +uvloop==0.21.0 From f7401a5935e6c5ba11aaec64b7b814e06b738ae5 Mon Sep 17 00:00:00 2001 From: Petrik de Heus Date: Tue, 18 Mar 2025 16:22:35 +0100 Subject: [PATCH 19/39] [ruby/hanami] Update to Hanami 2.2 (#9685) Move setting headers to application action. Use repo's for database operations. --- frameworks/Ruby/hanami/Gemfile | 9 +- frameworks/Ruby/hanami/Gemfile.lock | 96 ++++++++++--------- frameworks/Ruby/hanami/Procfile.dev | 2 + frameworks/Ruby/hanami/app/action.rb | 8 ++ .../Ruby/hanami/app/actions/db/index.rb | 9 +- .../Ruby/hanami/app/actions/json/index.rb | 2 - .../hanami/app/actions/plaintext/index.rb | 2 - .../Ruby/hanami/app/actions/queries/index.rb | 8 +- .../Ruby/hanami/app/actions/updates/index.rb | 12 +-- frameworks/Ruby/hanami/app/db/relation.rb | 10 ++ frameworks/Ruby/hanami/app/db/repo.rb | 10 ++ frameworks/Ruby/hanami/app/db/struct.rb | 10 ++ frameworks/Ruby/hanami/app/relations/.keep | 0 .../Ruby/hanami/app/relations/worlds.rb | 7 ++ frameworks/Ruby/hanami/app/repos/.keep | 0 .../Ruby/hanami/app/repos/world_repo.rb | 27 ++++++ frameworks/Ruby/hanami/app/structs/.keep | 0 .../hanami/app/templates/layouts/app.html.erb | 11 +++ frameworks/Ruby/hanami/app/view.rb | 9 ++ .../hanami/config/providers/persistence.rb | 32 ------- .../persistence/relations/world.rb | 9 -- 21 files changed, 158 insertions(+), 115 deletions(-) create mode 100644 frameworks/Ruby/hanami/Procfile.dev create mode 100644 frameworks/Ruby/hanami/app/db/relation.rb create mode 100644 frameworks/Ruby/hanami/app/db/repo.rb create mode 100644 frameworks/Ruby/hanami/app/db/struct.rb create mode 100644 frameworks/Ruby/hanami/app/relations/.keep create mode 100644 frameworks/Ruby/hanami/app/relations/worlds.rb create mode 100644 frameworks/Ruby/hanami/app/repos/.keep create mode 100644 frameworks/Ruby/hanami/app/repos/world_repo.rb create mode 100644 frameworks/Ruby/hanami/app/structs/.keep create mode 100644 frameworks/Ruby/hanami/app/templates/layouts/app.html.erb create mode 100644 frameworks/Ruby/hanami/app/view.rb delete mode 100644 frameworks/Ruby/hanami/config/providers/persistence.rb delete mode 100644 frameworks/Ruby/hanami/lib/hello_world/persistence/relations/world.rb diff --git a/frameworks/Ruby/hanami/Gemfile b/frameworks/Ruby/hanami/Gemfile index d1d45e22f87..ebc633433f4 100644 --- a/frameworks/Ruby/hanami/Gemfile +++ b/frameworks/Ruby/hanami/Gemfile @@ -2,10 +2,11 @@ source "https://rubygems.org" -gem "hanami", "~> 2.0" -gem "hanami-router", "~> 2.0" -gem "hanami-controller", "~> 2.0" -gem "hanami-validations", "~> 2.0" +gem "hanami", "~> 2.2" +gem "hanami-router", "~> 2.2" +gem "hanami-controller", "~> 2.2" +gem "hanami-db", "~> 2.2" +gem "hanami-validations", "~> 2.2" gem "dry-types", "~> 1.0", ">= 1.6.1" gem "puma" diff --git a/frameworks/Ruby/hanami/Gemfile.lock b/frameworks/Ruby/hanami/Gemfile.lock index 36b859fb018..09111dda2dc 100644 --- a/frameworks/Ruby/hanami/Gemfile.lock +++ b/frameworks/Ruby/hanami/Gemfile.lock @@ -2,7 +2,7 @@ GEM remote: https://rubygems.org/ specs: bigdecimal (3.1.9) - concurrent-ruby (1.3.4) + concurrent-ruby (1.3.5) dry-auto_inject (1.1.0) dry-core (~> 1.1) zeitwerk (~> 2.6) @@ -30,38 +30,38 @@ GEM dry-configurable (~> 1.0, < 2) dry-core (~> 1.0, < 2) dry-events (~> 1.0, < 2) - dry-schema (1.13.4) + dry-schema (1.14.1) concurrent-ruby (~> 1.0) dry-configurable (~> 1.0, >= 1.0.1) - dry-core (~> 1.0, < 2) - dry-initializer (~> 3.0) - dry-logic (>= 1.4, < 2) - dry-types (>= 1.7, < 2) - zeitwerk (~> 2.6) - dry-struct (1.7.0) dry-core (~> 1.1) + dry-initializer (~> 3.2) + dry-logic (~> 1.5) dry-types (~> 1.8) + zeitwerk (~> 2.6) + dry-struct (1.8.0) + dry-core (~> 1.1) + dry-types (~> 1.8, >= 1.8.2) ice_nine (~> 0.11) zeitwerk (~> 2.6) - dry-system (1.2.0) + dry-system (1.2.2) dry-auto_inject (~> 1.1) dry-configurable (~> 1.3) dry-core (~> 1.1) dry-inflector (~> 1.1) dry-transformer (1.0.1) zeitwerk (~> 2.6) - dry-types (1.8.0) + dry-types (1.8.2) bigdecimal (~> 3.0) concurrent-ruby (~> 1.0) dry-core (~> 1.0) dry-inflector (~> 1.0) dry-logic (~> 1.4) zeitwerk (~> 2.6) - dry-validation (1.10.0) + dry-validation (1.11.1) concurrent-ruby (~> 1.0) - dry-core (~> 1.0, < 2) - dry-initializer (~> 3.0) - dry-schema (>= 1.12, < 2) + dry-core (~> 1.1) + dry-initializer (~> 3.2) + dry-schema (~> 1.14) zeitwerk (~> 2.6) hanami (2.2.1) bundler (>= 1.16, < 3) @@ -82,13 +82,17 @@ GEM dry-inflector (~> 1.0, < 2) rake (~> 13.0) zeitwerk (~> 2.6) - hanami-controller (2.1.0) + hanami-controller (2.2.0) dry-configurable (~> 1.0, < 2) dry-core (~> 1.0) - hanami-utils (~> 2.1) + hanami-utils (~> 2.2) rack (~> 2.0) zeitwerk (~> 2.6) - hanami-router (2.1.0) + hanami-db (2.2.1) + rom (~> 5.4, >= 5.4.1) + rom-sql (~> 3.7) + zeitwerk (~> 2.6) + hanami-router (2.2.0) mustermann (~> 3.0) mustermann-contrib (~> 3.0) rack (~> 2.0) @@ -96,13 +100,12 @@ GEM concurrent-ruby (~> 1.0) dry-core (~> 1.0, < 2) dry-transformer (~> 1.0, < 2) - hanami-validations (2.1.0) + hanami-validations (2.2.0) dry-validation (>= 1.10, < 2) - zeitwerk (~> 2.6.0) hansi (0.2.1) ice_nine (0.11.2) - json (2.9.1) - logger (1.6.4) + json (2.10.2) + logger (1.6.6) mustermann (3.0.3) ruby2_keywords (~> 0.0.1) mustermann-contrib (3.0.3) @@ -110,41 +113,41 @@ GEM mustermann (= 3.0.3) nio4r (2.7.4) pg (1.5.9) - puma (6.5.0) + puma (6.6.0) nio4r (~> 2.0) - rack (2.2.9) + rack (2.2.13) rake (13.2.1) - rom (5.3.2) - rom-changeset (~> 5.3, >= 5.3.0) - rom-core (~> 5.3, >= 5.3.2) - rom-repository (~> 5.3, >= 5.3.0) - rom-changeset (5.3.0) + rom (5.4.2) + rom-changeset (~> 5.4) + rom-core (~> 5.4) + rom-repository (~> 5.4, >= 5.4.2) + rom-changeset (5.4.0) dry-core (~> 1.0) - rom-core (~> 5.3) - transproc (~> 1.0, >= 1.1.0) - rom-core (5.3.2) + rom-core (~> 5.4) + transproc (~> 1.1) + rom-core (5.4.0) concurrent-ruby (~> 1.1) dry-configurable (~> 1.0) dry-core (~> 1.0) dry-inflector (~> 1.0) - dry-initializer (~> 3.0, >= 3.0.1) + dry-initializer (~> 3.2) dry-struct (~> 1.0) dry-types (~> 1.6) - transproc (~> 1.0, >= 1.1.0) - rom-repository (5.3.0) - dry-core (~> 1.0) - dry-initializer (~> 3.0, >= 3.0.1) - rom-core (~> 5.3, >= 5.3.0) - rom-sql (3.6.5) + transproc (~> 1.1) + rom-repository (5.4.2) dry-core (~> 1.0) - dry-types (~> 1.0) - rom (~> 5.2, >= 5.2.1) + dry-initializer (~> 3.2) + rom-core (~> 5.4) + rom-sql (3.7.0) + dry-core (~> 1.1) + dry-types (~> 1.8) + rom (~> 5.4) sequel (>= 4.49) ruby2_keywords (0.0.5) - sequel (5.88.0) + sequel (5.90.0) bigdecimal transproc (1.1.1) - zeitwerk (2.6.18) + zeitwerk (2.7.2) PLATFORMS ruby @@ -152,10 +155,11 @@ PLATFORMS DEPENDENCIES dry-types (~> 1.0, >= 1.6.1) - hanami (~> 2.0) - hanami-controller (~> 2.0) - hanami-router (~> 2.0) - hanami-validations (~> 2.0) + hanami (~> 2.2) + hanami-controller (~> 2.2) + hanami-db (~> 2.2) + hanami-router (~> 2.2) + hanami-validations (~> 2.2) pg puma rake diff --git a/frameworks/Ruby/hanami/Procfile.dev b/frameworks/Ruby/hanami/Procfile.dev new file mode 100644 index 00000000000..04e92a10dc1 --- /dev/null +++ b/frameworks/Ruby/hanami/Procfile.dev @@ -0,0 +1,2 @@ +web: bundle exec hanami server +# assets: bundle exec hanami assets watch diff --git a/frameworks/Ruby/hanami/app/action.rb b/frameworks/Ruby/hanami/app/action.rb index 0771adb9298..8ef93e34f4a 100644 --- a/frameworks/Ruby/hanami/app/action.rb +++ b/frameworks/Ruby/hanami/app/action.rb @@ -5,5 +5,13 @@ module HelloWorld class Action < Hanami::Action + before :set_headers + + private + + def set_headers(*, response) + response.headers['Server'] = 'hanami' + response.headers['Date'] = Time.now.httpdate + end end end diff --git a/frameworks/Ruby/hanami/app/actions/db/index.rb b/frameworks/Ruby/hanami/app/actions/db/index.rb index 98b8ed970d8..e5efcc2f414 100644 --- a/frameworks/Ruby/hanami/app/actions/db/index.rb +++ b/frameworks/Ruby/hanami/app/actions/db/index.rb @@ -5,14 +5,13 @@ module Actions module DB class Index < HelloWorld::Action QUERY_RANGE = 1..10_000 # range of IDs in the Fortune DB - include Deps["persistence.rom"] + + include Deps["repos.world_repo"] def handle(*, response) - world = rom.relations[:World].by_pk(random_id).one - response.headers['Server'] = 'hanami' - response.headers['Date'] = Time.now.httpdate + world = world_repo.find(random_id) response.format = :json - response.body = world.to_json + response.body = world.to_h.to_json end def random_id diff --git a/frameworks/Ruby/hanami/app/actions/json/index.rb b/frameworks/Ruby/hanami/app/actions/json/index.rb index a49b641cb7c..9dd7220a45c 100644 --- a/frameworks/Ruby/hanami/app/actions/json/index.rb +++ b/frameworks/Ruby/hanami/app/actions/json/index.rb @@ -5,8 +5,6 @@ module Actions module JSON class Index < HelloWorld::Action def handle(*, response) - response.headers['Server'] = 'hanami' - response.headers['Date'] = Time.now.httpdate response.format = :json response.body = { 'message' => 'Hello, World!' }.to_json end diff --git a/frameworks/Ruby/hanami/app/actions/plaintext/index.rb b/frameworks/Ruby/hanami/app/actions/plaintext/index.rb index 62523769a66..dee41365b02 100644 --- a/frameworks/Ruby/hanami/app/actions/plaintext/index.rb +++ b/frameworks/Ruby/hanami/app/actions/plaintext/index.rb @@ -5,8 +5,6 @@ module Actions module Plaintext class Index < HelloWorld::Action def handle(*, response) - response.headers['Server'] = 'hanami' - response.headers['Date'] = Time.now.httpdate response.body = 'Hello, World!' end end diff --git a/frameworks/Ruby/hanami/app/actions/queries/index.rb b/frameworks/Ruby/hanami/app/actions/queries/index.rb index 5a1d0bd1419..d20dfc2df3a 100644 --- a/frameworks/Ruby/hanami/app/actions/queries/index.rb +++ b/frameworks/Ruby/hanami/app/actions/queries/index.rb @@ -9,16 +9,14 @@ class Index < HelloWorld::Action MIN_QUERIES = 1 # min number of records that can be retrieved MAX_QUERIES = 500 # max number of records that can be retrieved - include Deps["persistence.rom"] + include Deps["repos.world_repo"] def handle(request, response) worlds = ALL_IDS.sample(queries(request)).map do |id| - rom.relations[:World].by_pk(id).one + world_repo.find(id) end - response.headers['Server'] = 'hanami' - response.headers['Date'] = Time.now.httpdate response.format = :json - response.body = worlds.to_json + response.body = worlds.map(&:to_h).to_json end private diff --git a/frameworks/Ruby/hanami/app/actions/updates/index.rb b/frameworks/Ruby/hanami/app/actions/updates/index.rb index 54f963f7bf2..88c85a2ff60 100644 --- a/frameworks/Ruby/hanami/app/actions/updates/index.rb +++ b/frameworks/Ruby/hanami/app/actions/updates/index.rb @@ -9,20 +9,12 @@ class Index < HelloWorld::Action MIN_QUERIES = 1 # min number of records that can be retrieved MAX_QUERIES = 500 # max number of records that can be retrieved - include Deps["persistence.rom"] + include Deps["repos.world_repo"] def handle(request, response) worlds = ALL_IDS.sample(queries(request)).map do |id| - world = rom.relations[:World].by_pk(id) - world_struct = world.one - new_value = random_id - new_value = random_id while new_value == world_struct[:randomnumber] - world_struct[:randomnumber] = new_value - world.command(:update).call(randomnumber: world_struct[:randomnumber]) - world_struct + world_repo.update(id) end - response.headers['Server'] = 'hanami' - response.headers['Date'] = Time.now.httpdate response.format = :json response.body = worlds.to_json end diff --git a/frameworks/Ruby/hanami/app/db/relation.rb b/frameworks/Ruby/hanami/app/db/relation.rb new file mode 100644 index 00000000000..9ff3c56789f --- /dev/null +++ b/frameworks/Ruby/hanami/app/db/relation.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +require "hanami/db/relation" + +module HelloWorld + module DB + class Relation < Hanami::DB::Relation + end + end +end diff --git a/frameworks/Ruby/hanami/app/db/repo.rb b/frameworks/Ruby/hanami/app/db/repo.rb new file mode 100644 index 00000000000..586c7af94d0 --- /dev/null +++ b/frameworks/Ruby/hanami/app/db/repo.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +require "hanami/db/repo" + +module HelloWorld + module DB + class Repo < Hanami::DB::Repo + end + end +end diff --git a/frameworks/Ruby/hanami/app/db/struct.rb b/frameworks/Ruby/hanami/app/db/struct.rb new file mode 100644 index 00000000000..5484ea7c357 --- /dev/null +++ b/frameworks/Ruby/hanami/app/db/struct.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +require "hanami/db/struct" + +module HelloWorld + module DB + class Struct < Hanami::DB::Struct + end + end +end diff --git a/frameworks/Ruby/hanami/app/relations/.keep b/frameworks/Ruby/hanami/app/relations/.keep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/frameworks/Ruby/hanami/app/relations/worlds.rb b/frameworks/Ruby/hanami/app/relations/worlds.rb new file mode 100644 index 00000000000..54d982fa9bf --- /dev/null +++ b/frameworks/Ruby/hanami/app/relations/worlds.rb @@ -0,0 +1,7 @@ +module HelloWorld + module Relations + class Worlds < HelloWorld::DB::Relation + schema :World, infer: true, as: :worlds + end + end +end diff --git a/frameworks/Ruby/hanami/app/repos/.keep b/frameworks/Ruby/hanami/app/repos/.keep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/frameworks/Ruby/hanami/app/repos/world_repo.rb b/frameworks/Ruby/hanami/app/repos/world_repo.rb new file mode 100644 index 00000000000..40baa32c089 --- /dev/null +++ b/frameworks/Ruby/hanami/app/repos/world_repo.rb @@ -0,0 +1,27 @@ +module HelloWorld + module Repos + class WorldRepo < HelloWorld::DB::Repo + QUERY_RANGE = 1..10_000 # range of IDs in the Fortune DB + + def find(id) + worlds.by_pk(id).one + end + + def update(id) + world = worlds.by_pk(id) + world_hash = world.one.to_h + new_value = random_id + new_value = random_id while new_value == world_hash[:randomnumber] + world_hash[:randomnumber] = new_value + world.changeset(:update, **world_hash).commit + world_hash + end + + private + + def random_id + Random.rand(QUERY_RANGE) + end + end + end +end diff --git a/frameworks/Ruby/hanami/app/structs/.keep b/frameworks/Ruby/hanami/app/structs/.keep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/frameworks/Ruby/hanami/app/templates/layouts/app.html.erb b/frameworks/Ruby/hanami/app/templates/layouts/app.html.erb new file mode 100644 index 00000000000..ab87e9112bd --- /dev/null +++ b/frameworks/Ruby/hanami/app/templates/layouts/app.html.erb @@ -0,0 +1,11 @@ + + + + + + Bookshelf + + + <%= yield %> + + diff --git a/frameworks/Ruby/hanami/app/view.rb b/frameworks/Ruby/hanami/app/view.rb new file mode 100644 index 00000000000..d0a4d76065d --- /dev/null +++ b/frameworks/Ruby/hanami/app/view.rb @@ -0,0 +1,9 @@ +# auto_register: false +# frozen_string_literal: true + +require "hanami/view" + +module HelloWorld + class View < Hanami::View + end +end diff --git a/frameworks/Ruby/hanami/config/providers/persistence.rb b/frameworks/Ruby/hanami/config/providers/persistence.rb deleted file mode 100644 index 0aa12ececf6..00000000000 --- a/frameworks/Ruby/hanami/config/providers/persistence.rb +++ /dev/null @@ -1,32 +0,0 @@ -Hanami.app.register_provider :persistence, namespace: true do - prepare do - require "rom" - - require_relative '../auto_tune' - num_workers, num_threads = auto_tune - - opts = { - max_connections: 3, - pool_timeout: 10 - } - config = ROM::Configuration.new(:sql, target["settings"].database_url, opts) - - register "config", config - register "db", config.gateways[:default].connection - end - - start do - config = target["persistence.config"] - - config.auto_registration( - target.root.join("lib/hello_world/persistence"), - namespace: "HelloWorld::Persistence" - ) - - register "rom", ROM.container(config) - end - - stop do - target["persistence.rom"].disconnect - end -end diff --git a/frameworks/Ruby/hanami/lib/hello_world/persistence/relations/world.rb b/frameworks/Ruby/hanami/lib/hello_world/persistence/relations/world.rb deleted file mode 100644 index 2039d0481c9..00000000000 --- a/frameworks/Ruby/hanami/lib/hello_world/persistence/relations/world.rb +++ /dev/null @@ -1,9 +0,0 @@ -module HelloWorld - module Persistence - module Relations - class World < ROM::Relation[:sql] - schema(:World, infer: true) - end - end - end -end From 864558a389768832fff1a4ab7bc4a2121e5d6fc9 Mon Sep 17 00:00:00 2001 From: Petrik de Heus Date: Tue, 18 Mar 2025 18:19:06 +0100 Subject: [PATCH 20/39] [ruby/hanami] Add fortunes test (#9686) --- frameworks/Ruby/hanami/Gemfile | 1 + frameworks/Ruby/hanami/Gemfile.lock | 10 ++++++++++ .../Ruby/hanami/app/actions/fortunes/index.rb | 12 ++++++++++++ frameworks/Ruby/hanami/app/relations/fortunes.rb | 7 +++++++ frameworks/Ruby/hanami/app/repos/fortune_repo.rb | 11 +++++++++++ .../hanami/app/templates/fortunes/index.html.erb | 12 ++++++++++++ .../Ruby/hanami/app/templates/layouts/app.html.erb | 6 ++---- frameworks/Ruby/hanami/app/views/fortunes/index.rb | 14 ++++++++++++++ frameworks/Ruby/hanami/benchmark_config.json | 1 + frameworks/Ruby/hanami/config/routes.rb | 5 +++-- 10 files changed, 73 insertions(+), 6 deletions(-) create mode 100644 frameworks/Ruby/hanami/app/actions/fortunes/index.rb create mode 100644 frameworks/Ruby/hanami/app/relations/fortunes.rb create mode 100644 frameworks/Ruby/hanami/app/repos/fortune_repo.rb create mode 100644 frameworks/Ruby/hanami/app/templates/fortunes/index.html.erb create mode 100644 frameworks/Ruby/hanami/app/views/fortunes/index.rb diff --git a/frameworks/Ruby/hanami/Gemfile b/frameworks/Ruby/hanami/Gemfile index ebc633433f4..83b7c0d287b 100644 --- a/frameworks/Ruby/hanami/Gemfile +++ b/frameworks/Ruby/hanami/Gemfile @@ -7,6 +7,7 @@ gem "hanami-router", "~> 2.2" gem "hanami-controller", "~> 2.2" gem "hanami-db", "~> 2.2" gem "hanami-validations", "~> 2.2" +gem "hanami-view", "~> 2.2" gem "dry-types", "~> 1.0", ">= 1.6.1" gem "puma" diff --git a/frameworks/Ruby/hanami/Gemfile.lock b/frameworks/Ruby/hanami/Gemfile.lock index 09111dda2dc..a1d3a8ff478 100644 --- a/frameworks/Ruby/hanami/Gemfile.lock +++ b/frameworks/Ruby/hanami/Gemfile.lock @@ -102,6 +102,13 @@ GEM dry-transformer (~> 1.0, < 2) hanami-validations (2.2.0) dry-validation (>= 1.10, < 2) + hanami-view (2.2.1) + dry-configurable (~> 1.0) + dry-core (~> 1.0) + dry-inflector (~> 1.0, < 2) + temple (~> 0.10.0, >= 0.10.2) + tilt (~> 2.3) + zeitwerk (~> 2.6) hansi (0.2.1) ice_nine (0.11.2) json (2.10.2) @@ -146,6 +153,8 @@ GEM ruby2_keywords (0.0.5) sequel (5.90.0) bigdecimal + temple (0.10.3) + tilt (2.6.0) transproc (1.1.1) zeitwerk (2.7.2) @@ -160,6 +169,7 @@ DEPENDENCIES hanami-db (~> 2.2) hanami-router (~> 2.2) hanami-validations (~> 2.2) + hanami-view (~> 2.2) pg puma rake diff --git a/frameworks/Ruby/hanami/app/actions/fortunes/index.rb b/frameworks/Ruby/hanami/app/actions/fortunes/index.rb new file mode 100644 index 00000000000..4d6bbbba502 --- /dev/null +++ b/frameworks/Ruby/hanami/app/actions/fortunes/index.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +module HelloWorld + module Actions + module Fortunes + class Index < HelloWorld::Action + def handle(*, response) + end + end + end + end +end diff --git a/frameworks/Ruby/hanami/app/relations/fortunes.rb b/frameworks/Ruby/hanami/app/relations/fortunes.rb new file mode 100644 index 00000000000..d35a05575f1 --- /dev/null +++ b/frameworks/Ruby/hanami/app/relations/fortunes.rb @@ -0,0 +1,7 @@ +module HelloWorld + module Relations + class Fortunes < HelloWorld::DB::Relation + schema :Fortune, infer: true, as: :fortunes + end + end +end diff --git a/frameworks/Ruby/hanami/app/repos/fortune_repo.rb b/frameworks/Ruby/hanami/app/repos/fortune_repo.rb new file mode 100644 index 00000000000..c356c615e91 --- /dev/null +++ b/frameworks/Ruby/hanami/app/repos/fortune_repo.rb @@ -0,0 +1,11 @@ +module HelloWorld + module Repos + class FortuneRepo < HelloWorld::DB::Repo + def all + results = fortunes.to_a.map(&:to_h) + results << { id: 0, message: 'Additional fortune added at request time.' } + results.sort_by! { |fortune| fortune[:message] } + end + end + end +end diff --git a/frameworks/Ruby/hanami/app/templates/fortunes/index.html.erb b/frameworks/Ruby/hanami/app/templates/fortunes/index.html.erb new file mode 100644 index 00000000000..eacad31aca9 --- /dev/null +++ b/frameworks/Ruby/hanami/app/templates/fortunes/index.html.erb @@ -0,0 +1,12 @@ + + + + + + <% fortunes.each do |fortune| %> + + + + + <% end %> +
idmessage
<%= fortune[:id] %><%= fortune[:message] %>
diff --git a/frameworks/Ruby/hanami/app/templates/layouts/app.html.erb b/frameworks/Ruby/hanami/app/templates/layouts/app.html.erb index ab87e9112bd..2c125c136fd 100644 --- a/frameworks/Ruby/hanami/app/templates/layouts/app.html.erb +++ b/frameworks/Ruby/hanami/app/templates/layouts/app.html.erb @@ -1,9 +1,7 @@ - + - - - Bookshelf + Fortunes <%= yield %> diff --git a/frameworks/Ruby/hanami/app/views/fortunes/index.rb b/frameworks/Ruby/hanami/app/views/fortunes/index.rb new file mode 100644 index 00000000000..5eb7d500305 --- /dev/null +++ b/frameworks/Ruby/hanami/app/views/fortunes/index.rb @@ -0,0 +1,14 @@ +module HelloWorld + module Views + module Fortunes + class Index < HelloWorld::View + + include Deps["repos.fortune_repo"] + + expose :fortunes do + fortune_repo.all + end + end + end + end +end diff --git a/frameworks/Ruby/hanami/benchmark_config.json b/frameworks/Ruby/hanami/benchmark_config.json index d384577682c..1a081210b16 100644 --- a/frameworks/Ruby/hanami/benchmark_config.json +++ b/frameworks/Ruby/hanami/benchmark_config.json @@ -5,6 +5,7 @@ "json_url": "/json", "db_url": "/db", "query_url": "/queries?queries=", + "fortune_url": "/fortunes", "update_url": "/updates?queries=", "plaintext_url": "/plaintext", "port": 8080, diff --git a/frameworks/Ruby/hanami/config/routes.rb b/frameworks/Ruby/hanami/config/routes.rb index d568af27c70..55f2f414845 100644 --- a/frameworks/Ruby/hanami/config/routes.rb +++ b/frameworks/Ruby/hanami/config/routes.rb @@ -2,10 +2,11 @@ module HelloWorld class Routes < Hanami::Routes - get "/db", to: "db.index" get "/json", to: "json.index" + get "/db", to: "db.index" + get "/queries", to: "queries.index" + get "/fortunes", to: "fortunes.index" get "/updates", to: "updates.index" get "/plaintext", to: "plaintext.index" - get "/queries", to: "queries.index" end end From a88f9784f1434b597c88f19cf2bd10776737d3e8 Mon Sep 17 00:00:00 2001 From: Petrik de Heus Date: Tue, 18 Mar 2025 18:20:31 +0100 Subject: [PATCH 21/39] [ruby/hanami] Upgrade to Ruby 3.4 (#9688) --- frameworks/Ruby/hanami/hanami.dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frameworks/Ruby/hanami/hanami.dockerfile b/frameworks/Ruby/hanami/hanami.dockerfile index 09892d3f9e7..80ab2a6c31f 100644 --- a/frameworks/Ruby/hanami/hanami.dockerfile +++ b/frameworks/Ruby/hanami/hanami.dockerfile @@ -1,4 +1,4 @@ -FROM ruby:3.3 +FROM ruby:3.4 ENV RUBY_YJIT_ENABLE=1 From d4acac67b29b7294d2ee83c59b6e826036405db7 Mon Sep 17 00:00:00 2001 From: Petrik de Heus Date: Tue, 18 Mar 2025 18:21:01 +0100 Subject: [PATCH 22/39] [ruby/grape] Update dependencies (#9689) Also increase the connection pool to 3 (similar to Rails). +-------------------------+---------+------+-----+-----+-----+--------------+ | branch_name|plaintext|update| json| db|query|weighted_score| +-------------------------+---------+------+-----+-----+-----+--------------+ | master| 19841| 10008|57534|25783|13696| 1087| |grape/update-dependencies| 22286| 10680|58089|28088|17152| 1213| +-------------------------+---------+------+-----+-----+-----+--------------+ --- frameworks/Ruby/grape/Gemfile | 7 +++---- frameworks/Ruby/grape/config.ru | 6 +++--- frameworks/Ruby/grape/config/database.yml | 2 +- frameworks/Ruby/grape/config/puma.rb | 2 +- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/frameworks/Ruby/grape/Gemfile b/frameworks/Ruby/grape/Gemfile index 1aea70fade0..b1e9fe3b4d5 100644 --- a/frameworks/Ruby/grape/Gemfile +++ b/frameworks/Ruby/grape/Gemfile @@ -2,8 +2,7 @@ source 'https://rubygems.org' gem 'mysql2', '0.5.6' gem 'unicorn', '6.1.0' -gem 'puma', '~> 6.4' -gem 'activerecord', '~> 7.1.0', :require => 'active_record' +gem 'puma', '~> 6.5' +gem 'activerecord', '~> 8.0.0', :require => 'active_record' gem 'grape', '2.1.1' -gem 'multi_json', require: 'multi_json' -gem 'oj', '~> 3.16' +gem 'json', '~> 2.9' diff --git a/frameworks/Ruby/grape/config.ru b/frameworks/Ruby/grape/config.ru index a91b5364a11..334605c20c4 100644 --- a/frameworks/Ruby/grape/config.ru +++ b/frameworks/Ruby/grape/config.ru @@ -48,13 +48,13 @@ module Acme end get '/db' do - ActiveRecord::Base.connection_pool.with_connection do + ActiveRecord::Base.with_connection do World.find(rand1).attributes end end get '/query' do - ActiveRecord::Base.connection_pool.with_connection do + ActiveRecord::Base.with_connection do ALL_IDS.sample(bounded_queries).map do |id| World.find(id) end @@ -63,7 +63,7 @@ module Acme get '/updates' do worlds = - ActiveRecord::Base.connection_pool.with_connection do + ActiveRecord::Base.with_connection do ALL_IDS.sample(bounded_queries).map do |id| world = World.find(id) new_value = rand1 diff --git a/frameworks/Ruby/grape/config/database.yml b/frameworks/Ruby/grape/config/database.yml index 40b271b409a..9be8d7d851a 100644 --- a/frameworks/Ruby/grape/config/database.yml +++ b/frameworks/Ruby/grape/config/database.yml @@ -5,5 +5,5 @@ production: database: hello_world username: benchmarkdbuser password: benchmarkdbpass - pool: 2 + pool: 3 timeout: 5000 diff --git a/frameworks/Ruby/grape/config/puma.rb b/frameworks/Ruby/grape/config/puma.rb index b187587b799..1ac05407d4a 100644 --- a/frameworks/Ruby/grape/config/puma.rb +++ b/frameworks/Ruby/grape/config/puma.rb @@ -5,7 +5,7 @@ workers num_workers -threads 2, 2 +threads 3, 3 # Use the `preload_app!` method when specifying a `workers` number. # This directive tells Puma to first boot the application and load code From 46de0d47a80275762b1e00c01a193b429bfac56a Mon Sep 17 00:00:00 2001 From: Petrik de Heus Date: Tue, 18 Mar 2025 19:03:38 +0100 Subject: [PATCH 23/39] [ruby/hanami] Return json and plaintext from the routes. (#9687) --- .../Ruby/hanami/app/actions/json/index.rb | 14 ------------- .../hanami/app/actions/plaintext/index.rb | 13 ------------ frameworks/Ruby/hanami/config/routes.rb | 20 +++++++++++++++++-- 3 files changed, 18 insertions(+), 29 deletions(-) delete mode 100644 frameworks/Ruby/hanami/app/actions/json/index.rb delete mode 100644 frameworks/Ruby/hanami/app/actions/plaintext/index.rb diff --git a/frameworks/Ruby/hanami/app/actions/json/index.rb b/frameworks/Ruby/hanami/app/actions/json/index.rb deleted file mode 100644 index 9dd7220a45c..00000000000 --- a/frameworks/Ruby/hanami/app/actions/json/index.rb +++ /dev/null @@ -1,14 +0,0 @@ -# frozen_string_literal: true - -module HelloWorld - module Actions - module JSON - class Index < HelloWorld::Action - def handle(*, response) - response.format = :json - response.body = { 'message' => 'Hello, World!' }.to_json - end - end - end - end -end diff --git a/frameworks/Ruby/hanami/app/actions/plaintext/index.rb b/frameworks/Ruby/hanami/app/actions/plaintext/index.rb deleted file mode 100644 index dee41365b02..00000000000 --- a/frameworks/Ruby/hanami/app/actions/plaintext/index.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -module HelloWorld - module Actions - module Plaintext - class Index < HelloWorld::Action - def handle(*, response) - response.body = 'Hello, World!' - end - end - end - end -end diff --git a/frameworks/Ruby/hanami/config/routes.rb b/frameworks/Ruby/hanami/config/routes.rb index 55f2f414845..b57e5af753f 100644 --- a/frameworks/Ruby/hanami/config/routes.rb +++ b/frameworks/Ruby/hanami/config/routes.rb @@ -2,11 +2,27 @@ module HelloWorld class Routes < Hanami::Routes - get "/json", to: "json.index" + get "/json", to: ->(env) do + [200, + { + 'Server' => 'Rails', + 'Content-Type' => 'application/json', + 'Date' => Time.now.httpdate, + }, + [{ 'message' => 'Hello, World!' }.to_json]] + end get "/db", to: "db.index" get "/queries", to: "queries.index" get "/fortunes", to: "fortunes.index" get "/updates", to: "updates.index" - get "/plaintext", to: "plaintext.index" + get "/plaintext", to: ->(env) do + [200, + { + 'Server' => 'Hanami', + 'Content-Type' => 'text/plain', + 'Date' => Time.now.httpdate + }, + ['Hello, World!']] + end end end From 1b5925e0df2450679d5dec8f1dd25004e78a9544 Mon Sep 17 00:00:00 2001 From: Tong Li <31761981+litongjava@users.noreply.github.com> Date: Wed, 19 Mar 2025 11:11:55 -1000 Subject: [PATCH 24/39] add logback to tio-boot (#9690) * change to for each * add logback --------- Co-authored-by: litongjava --- frameworks/Java/tio-boot/pom.xml | 7 +- .../tio/http/server/MainAppConfig.java | 39 +++++----- .../http/server/controller/CacheHandler.java | 36 ++++----- .../tio/http/server/controller/DbHandler.java | 77 ++++++++++--------- .../http/server/controller/IndexHandler.java | 22 +++--- .../tio-boot/src/main/resources/logback.xml | 41 +++++----- .../tio/http/server/MainAppTest.java | 3 +- 7 files changed, 116 insertions(+), 109 deletions(-) diff --git a/frameworks/Java/tio-boot/pom.xml b/frameworks/Java/tio-boot/pom.xml index d72bc47bb04..73443cb3c08 100644 --- a/frameworks/Java/tio-boot/pom.xml +++ b/frameworks/Java/tio-boot/pom.xml @@ -27,8 +27,14 @@ com.litongjava java-db 1.5.0 +
+ + ch.qos.logback + logback-classic + 1.2.3 + junit junit @@ -36,7 +42,6 @@ test - com.alibaba.fastjson2 fastjson2 diff --git a/frameworks/Java/tio-boot/src/main/java/com/litongjava/tio/http/server/MainAppConfig.java b/frameworks/Java/tio-boot/src/main/java/com/litongjava/tio/http/server/MainAppConfig.java index 8f9472597c1..2852e830fe4 100644 --- a/frameworks/Java/tio-boot/src/main/java/com/litongjava/tio/http/server/MainAppConfig.java +++ b/frameworks/Java/tio-boot/src/main/java/com/litongjava/tio/http/server/MainAppConfig.java @@ -15,24 +15,6 @@ public class MainAppConfig implements BootConfiguration { @Override public void config() throws Exception { - // add route - IndexHandler controller = new IndexHandler(); - - TioBootServer server = TioBootServer.me(); - HttpRequestRouter requestRouter = server.getRequestRouter(); - - requestRouter.add("/", controller::index); - requestRouter.add("/plaintext", controller::plaintext); - requestRouter.add("/json", controller::json); - - DbHandler dbQueryController = new DbHandler(); - requestRouter.add("/db", dbQueryController::db); - requestRouter.add("/queries", dbQueryController::queries); - requestRouter.add("/updates", dbQueryController::updates); - requestRouter.add("/fortunes", dbQueryController::fortunes); - - CacheHandler cacheController = new CacheHandler(); - requestRouter.add("/cachedQuery", cacheController::cachedQuery); boolean db = EnvUtils.getBoolean("db", true); if (db) { @@ -49,6 +31,25 @@ public void config() throws Exception { } catch (Exception e) { e.printStackTrace(); } - } + // add route + IndexHandler controller = new IndexHandler(); + + TioBootServer server = TioBootServer.me(); + HttpRequestRouter requestRouter = server.getRequestRouter(); + if (requestRouter != null) { + requestRouter.add("/", controller::index); + requestRouter.add("/plaintext", controller::plaintext); + requestRouter.add("/json", controller::json); + + DbHandler dbQueryController = new DbHandler(); + requestRouter.add("/db", dbQueryController::db); + requestRouter.add("/queries", dbQueryController::queries); + requestRouter.add("/updates", dbQueryController::updates); + requestRouter.add("/fortunes", dbQueryController::fortunes); + + CacheHandler cacheController = new CacheHandler(); + requestRouter.add("/cachedQuery", cacheController::cachedQuery); + } + } } diff --git a/frameworks/Java/tio-boot/src/main/java/com/litongjava/tio/http/server/controller/CacheHandler.java b/frameworks/Java/tio-boot/src/main/java/com/litongjava/tio/http/server/controller/CacheHandler.java index d3546c09111..c0d1f9c3066 100644 --- a/frameworks/Java/tio-boot/src/main/java/com/litongjava/tio/http/server/controller/CacheHandler.java +++ b/frameworks/Java/tio-boot/src/main/java/com/litongjava/tio/http/server/controller/CacheHandler.java @@ -1,13 +1,13 @@ package com.litongjava.tio.http.server.controller; +import java.util.ArrayList; import java.util.List; import java.util.Map; -import java.util.Objects; -import java.util.stream.Collectors; import com.alibaba.fastjson2.JSON; import com.litongjava.db.activerecord.Db; import com.litongjava.db.activerecord.Row; +import com.litongjava.tio.boot.http.TioRequestContext; import com.litongjava.tio.http.common.HeaderName; import com.litongjava.tio.http.common.HeaderValue; import com.litongjava.tio.http.common.HttpRequest; @@ -16,26 +16,26 @@ public class CacheHandler { // private Logger log = LoggerFactory.getLogger(this.getClass()); + String sql = "SELECT id, randomNumber FROM world WHERE id = ?"; public HttpResponse cachedQuery(HttpRequest request) { String queries = request.getParam("queries"); - List> recordMaps = RandomUtils.randomWorldNumbers() - // limit - .limit(RandomUtils.parseQueryCount(queries)) // 限制查询数量 - .mapToObj(id -> findByIdWithCache("world", id)) // 使用 mapToObj 将 int 映射为对象 - .filter(Objects::nonNull) // 过滤掉 null 值 - .map(Row::toMap) // 将每个 Record 对象转换为 Map - .collect(Collectors.toList()); // 收集到 List - - HttpResponse httpResponse = new HttpResponse(request); - httpResponse.addHeader(HeaderName.Content_Type, HeaderValue.Content_Type.TEXT_PLAIN_JSON); - httpResponse.setBody(JSON.toJSONBytes(recordMaps)); - return httpResponse; - } + int queryCount = RandomUtils.parseQueryCount(queries); + + List> recordMaps = new ArrayList<>(); + + int[] randomNumbers = RandomUtils.randomWorldNumbers().limit(queryCount).toArray(); + for (int id : randomNumbers) { + Row row = Db.findFirstByCache("world", id, sql, id); + if (row != null) { + recordMaps.add(row.toMap()); + } + } - private Row findByIdWithCache(String tableName, int id) { - String sql = "SELECT id, randomNumber FROM world WHERE id = ?"; - return Db.findFirstByCache(tableName, id, sql, id); + HttpResponse response = TioRequestContext.getResponse(); + response.addHeader(HeaderName.Content_Type, HeaderValue.Content_Type.TEXT_PLAIN_JSON); + response.setBody(JSON.toJSONBytes(recordMaps)); + return response; } } diff --git a/frameworks/Java/tio-boot/src/main/java/com/litongjava/tio/http/server/controller/DbHandler.java b/frameworks/Java/tio-boot/src/main/java/com/litongjava/tio/http/server/controller/DbHandler.java index a7a127795ec..3ab48edeba2 100644 --- a/frameworks/Java/tio-boot/src/main/java/com/litongjava/tio/http/server/controller/DbHandler.java +++ b/frameworks/Java/tio-boot/src/main/java/com/litongjava/tio/http/server/controller/DbHandler.java @@ -5,8 +5,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Objects; -import java.util.stream.Collectors; import com.alibaba.fastjson2.JSON; import com.jfinal.template.Engine; @@ -14,6 +12,7 @@ import com.litongjava.db.activerecord.Db; import com.litongjava.db.activerecord.Row; import com.litongjava.ehcache.EhCacheKit; +import com.litongjava.tio.boot.http.TioRequestContext; import com.litongjava.tio.http.common.HeaderName; import com.litongjava.tio.http.common.HeaderValue; import com.litongjava.tio.http.common.HttpRequest; @@ -23,6 +22,10 @@ import com.litongjava.tio.http.server.utils.RandomUtils; public class DbHandler { + private Engine engine = Engine.use(); + private String filename = "fortunes.html"; + private Template template = engine.getTemplate(filename); + private static final byte[] bytes = "{}".getBytes(); public HttpResponse db(HttpRequest request) { Integer id = request.getInt("id"); @@ -31,7 +34,7 @@ public HttpResponse db(HttpRequest request) { } //System.out.println("id:" + id); - HttpResponse httpResponse = new HttpResponse(request); + HttpResponse httpResponse = TioRequestContext.getResponse(); // int id = 11; // String sql="SELECT id, randomNumber FROM world WHERE id = ?"; @@ -40,7 +43,7 @@ public HttpResponse db(HttpRequest request) { if (recored != null) { httpResponse.setBody(JSON.toJSONBytes(recored.toMap())); } else { - httpResponse.setBody("{}".getBytes()); + httpResponse.setBody(bytes); } httpResponse.addHeader(HeaderName.Content_Type, HeaderValue.Content_Type.TEXT_PLAIN_JSON); @@ -51,15 +54,19 @@ public HttpResponse db(HttpRequest request) { // @GetMapping("/queries") public HttpResponse queries(HttpRequest request) { String queries = request.getParam("queries"); - List> recordMaps = RandomUtils.randomWorldNumbers() - // limit - .limit(RandomUtils.parseQueryCount(queries)) // 限制查询数量 - .mapToObj(id -> Db.findById("world", id)) // 使用 mapToObj 将 int 映射为对象 - .filter(Objects::nonNull) // 过滤掉 null 值 - .map(Row::toMap) // 将每个 Record 对象转换为 Map - .collect(Collectors.toList()); // 收集到 List + int queryCount = RandomUtils.parseQueryCount(queries); + int[] randomNumbers = RandomUtils.randomWorldNumbers().limit(queryCount).toArray(); - HttpResponse httpResponse = new HttpResponse(request); + List> recordMaps = new ArrayList<>(); + + for (int id : randomNumbers) { + Row row = Db.findById("world", id); + if (row != null) { + recordMaps.add(row.toMap()); + } + } + + HttpResponse httpResponse = TioRequestContext.getResponse(); httpResponse.addHeader(HeaderName.Content_Type, HeaderValue.Content_Type.TEXT_PLAIN_JSON); httpResponse.setBody(JSON.toJSONBytes(recordMaps)); return httpResponse; @@ -71,27 +78,24 @@ public HttpResponse updates(HttpRequest request) { EhCacheKit.removeAll("world"); - List> updatedRecords = RandomUtils.randomWorldNumbers()// random numbers - // limit - .limit(RandomUtils.parseQueryCount(queries)) - // map - .mapToObj(id -> Db.findById("world", id)) - // not null - .filter(Objects::nonNull).map(record -> { - int currentRandomNumber = record.getInt("randomNumber"); // "randomnumber" - int newRandomNumber; - do { - newRandomNumber = RandomUtils.randomWorldNumber(); - } while (newRandomNumber == currentRandomNumber); - - record.set("randomnumber", newRandomNumber); - Db.update("world", "id", record); // update - return record; - }) - // tomap - .map(Row::toMap) - // to List - .collect(Collectors.toList()); + int queryCount = RandomUtils.parseQueryCount(queries); + int[] randomNumbers = RandomUtils.randomWorldNumbers().limit(queryCount).toArray(); + List> updatedRecords = new ArrayList<>(); + + for (int id : randomNumbers) { + Row row = Db.findById("world", id); + if (row != null) { + int currentRandomNumber = row.getInt("randomNumber"); // "randomnumber" + int newRandomNumber; + do { + newRandomNumber = RandomUtils.randomWorldNumber(); + } while (newRandomNumber == currentRandomNumber); + + row.set("randomnumber", newRandomNumber); + Db.update("world", "id", row); // update + updatedRecords.add(row.toMap()); + } + } HttpResponse httpResponse = new HttpResponse(request); httpResponse.addHeader(HeaderName.Content_Type, HeaderValue.Content_Type.TEXT_PLAIN_JSON); @@ -116,11 +120,8 @@ public HttpResponse fortunes(HttpRequest request) throws IllegalAccessException, viewData.put("fortunes", fortunes); // 转换为 HTML - Engine engine = Engine.use(); - String filename = "fortunes.html"; - Template template = engine.getTemplate(filename); String html = template.renderToString(viewData); - - return Resps.html(request, html); + HttpResponse httpResponse = TioRequestContext.getResponse(); + return Resps.html(httpResponse, html); } } diff --git a/frameworks/Java/tio-boot/src/main/java/com/litongjava/tio/http/server/controller/IndexHandler.java b/frameworks/Java/tio-boot/src/main/java/com/litongjava/tio/http/server/controller/IndexHandler.java index 2b2bc4c5535..3dd0ba384b9 100644 --- a/frameworks/Java/tio-boot/src/main/java/com/litongjava/tio/http/server/controller/IndexHandler.java +++ b/frameworks/Java/tio-boot/src/main/java/com/litongjava/tio/http/server/controller/IndexHandler.java @@ -1,6 +1,7 @@ package com.litongjava.tio.http.server.controller; import com.alibaba.fastjson2.JSON; +import com.litongjava.tio.boot.http.TioRequestContext; import com.litongjava.tio.http.common.HeaderName; import com.litongjava.tio.http.common.HeaderValue; import com.litongjava.tio.http.common.HttpRequest; @@ -22,19 +23,16 @@ public HttpResponse index(HttpRequest request) { } public HttpResponse plaintext(HttpRequest request) { - // 更高性能的写法 - HttpResponse ret = new HttpResponse(request); - ret.setBody(HELLO_WORLD_BYTES); - ret.addHeader(HeaderName.Content_Type, HeaderValue.Content_Type.TEXT_PLAIN_TXT); - return ret; + HttpResponse response = TioRequestContext.getResponse(); + response.setBody(HELLO_WORLD_BYTES); + response.addHeader(HeaderName.Content_Type, HeaderValue.Content_Type.TEXT_PLAIN_TXT); + return response; } - // 在IndexController中添加 public HttpResponse json(HttpRequest request) { - // 更高性能的写法 - HttpResponse ret = new HttpResponse(request); - ret.setBody(JSON.toJSONString(new Message(HELLO_WORLD)).getBytes()); - ret.addHeader(HeaderName.Content_Type, HeaderValue.Content_Type.TEXT_PLAIN_JSON); - return ret; + HttpResponse response = TioRequestContext.getResponse(); + response.setBody(JSON.toJSONBytes(new Message(HELLO_WORLD))); + response.addHeader(HeaderName.Content_Type, HeaderValue.Content_Type.TEXT_PLAIN_JSON); + return response; } -} +} \ No newline at end of file diff --git a/frameworks/Java/tio-boot/src/main/resources/logback.xml b/frameworks/Java/tio-boot/src/main/resources/logback.xml index aff0c711191..6065c075e78 100644 --- a/frameworks/Java/tio-boot/src/main/resources/logback.xml +++ b/frameworks/Java/tio-boot/src/main/resources/logback.xml @@ -1,9 +1,13 @@ - - + + + - - + + + @@ -12,41 +16,40 @@ - + ${CONSOLE_LOG_PATTERN} - - - ${LOG_HOME}/project-name-%d{yyyy-MM-dd}.log - + + + ${LOG_HOME}/log.%d{yyyyMMddHH}.%i.log + 180 + + 100MB - - - 10MB - - - + + - + + - + - + - \ No newline at end of file + diff --git a/frameworks/Java/tio-boot/src/test/java/com/litongjava/tio/http/server/MainAppTest.java b/frameworks/Java/tio-boot/src/test/java/com/litongjava/tio/http/server/MainAppTest.java index e469fa256ef..41b724b15c4 100644 --- a/frameworks/Java/tio-boot/src/test/java/com/litongjava/tio/http/server/MainAppTest.java +++ b/frameworks/Java/tio-boot/src/test/java/com/litongjava/tio/http/server/MainAppTest.java @@ -6,10 +6,9 @@ public class MainAppTest { - @Test + // @Test public void test() { boolean boolean1 = EnvUtils.getBoolean("native", false); System.out.println(boolean1); } - } From 9e7dd42ce9b49392c4671bd8658e57fa4fd02618 Mon Sep 17 00:00:00 2001 From: Petrik de Heus Date: Wed, 19 Mar 2025 22:12:11 +0100 Subject: [PATCH 25/39] [rails] Warmup cache before starting up (#9691) Also make sure records are always loaded from cache for cached_query. --- .../Ruby/rails/app/controllers/hello_world_controller.rb | 5 +++-- frameworks/Ruby/rails/config/application.rb | 6 ++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/frameworks/Ruby/rails/app/controllers/hello_world_controller.rb b/frameworks/Ruby/rails/app/controllers/hello_world_controller.rb index d4582e18c02..526d850e94c 100644 --- a/frameworks/Ruby/rails/app/controllers/hello_world_controller.rb +++ b/frameworks/Ruby/rails/app/controllers/hello_world_controller.rb @@ -21,8 +21,9 @@ def query end def cached_query - items = Rails.cache.fetch_multi(*ALL_IDS.sample(query_count)) do |id| - World.find(id).as_json + keys = ALL_IDS.sample(query_count).map { "world_#{_1}" } + items = Rails.cache.fetch_multi(*keys) do |id| + raise "Could not find World with id: #{id} in cache" end render json: items.values diff --git a/frameworks/Ruby/rails/config/application.rb b/frameworks/Ruby/rails/config/application.rb index 8f5abd7901b..19ca9a41572 100644 --- a/frameworks/Ruby/rails/config/application.rb +++ b/frameworks/Ruby/rails/config/application.rb @@ -47,5 +47,11 @@ class Application < Rails::Application config.middleware.delete Rails::Rack::Logger config.active_support.isolation_level = :fiber if defined?(Falcon) + + config.to_prepare do + HelloWorldController::ALL_IDS.each do |id| + Rails.cache.write("world_#{id}", World.find(id).as_json, expires_in: 1.day) + end + end end end From e96c213b98b63652794f507a6a7bbe9e3178a6e3 Mon Sep 17 00:00:00 2001 From: rio Date: Thu, 20 Mar 2025 06:12:29 +0900 Subject: [PATCH 26/39] [PHP/Codeigniter] Update PHP version 8.4 (#9408) (#9692) --- frameworks/PHP/codeigniter/codeigniter.dockerfile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/frameworks/PHP/codeigniter/codeigniter.dockerfile b/frameworks/PHP/codeigniter/codeigniter.dockerfile index e04cf572ab6..097ea60514d 100644 --- a/frameworks/PHP/codeigniter/codeigniter.dockerfile +++ b/frameworks/PHP/codeigniter/codeigniter.dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:22.04 +FROM ubuntu:24.04 ARG DEBIAN_FRONTEND=noninteractive @@ -7,16 +7,16 @@ RUN LC_ALL=C.UTF-8 add-apt-repository ppa:ondrej/php > /dev/null && \ apt-get update -yqq > /dev/null && apt-get upgrade -yqq > /dev/null RUN apt-get update > /dev/null && apt-get install -yqq nginx git unzip \ - php8.3-cli php8.3-fpm php8.3-mysql php8.3-mbstring php8.3-intl php8.3-curl > /dev/null + php8.4-cli php8.4-fpm php8.4-mysql php8.4-mbstring php8.4-intl php8.4-curl > /dev/null COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer -COPY deploy/conf/* /etc/php/8.3/fpm/ +COPY deploy/conf/* /etc/php/8.4/fpm/ ADD ./ /codeigniter WORKDIR /codeigniter -RUN if [ $(nproc) = 2 ]; then sed -i "s|pm.max_children = 1024|pm.max_children = 512|g" /etc/php/8.3/fpm/php-fpm.conf ; fi; +RUN if [ $(nproc) = 2 ]; then sed -i "s|pm.max_children = 1024|pm.max_children = 512|g" /etc/php/8.4/fpm/php-fpm.conf ; fi; RUN composer install --optimize-autoloader --classmap-authoritative --no-dev #--quiet @@ -25,5 +25,5 @@ RUN chmod -R 777 writable EXPOSE 8080 -CMD service php8.3-fpm start && \ +CMD service php8.4-fpm start && \ nginx -c /codeigniter/deploy/nginx.conf From 84c55271552017e1e3e8a47a85d48618ba9e7d68 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 19 Mar 2025 21:12:51 +0000 Subject: [PATCH 27/39] Bump ch.qos.logback:logback-classic in /frameworks/Java/tio-boot Bumps [ch.qos.logback:logback-classic](https://github.com/qos-ch/logback) from 1.2.3 to 1.2.13. - [Release notes](https://github.com/qos-ch/logback/releases) - [Commits](https://github.com/qos-ch/logback/compare/v_1.2.3...v_1.2.13) --- updated-dependencies: - dependency-name: ch.qos.logback:logback-classic dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- frameworks/Java/tio-boot/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frameworks/Java/tio-boot/pom.xml b/frameworks/Java/tio-boot/pom.xml index 73443cb3c08..cb358e64621 100644 --- a/frameworks/Java/tio-boot/pom.xml +++ b/frameworks/Java/tio-boot/pom.xml @@ -32,7 +32,7 @@ ch.qos.logback logback-classic - 1.2.3 + 1.2.13 From a4f4da099882774c109f2133a7698aeaf021fe53 Mon Sep 17 00:00:00 2001 From: rio Date: Thu, 20 Mar 2025 06:12:57 +0900 Subject: [PATCH 28/39] [Python/Django] Update Python version 3.12 (#9694) --- frameworks/Python/django/benchmark_config.json | 4 ++-- .../Python/django/django-postgresql.dockerfile | 2 +- frameworks/Python/django/django.dockerfile | 2 +- frameworks/Python/django/gunicorn_conf.py | 16 ++-------------- .../Python/django/requirements-gunicorn.txt | 6 +++--- frameworks/Python/django/requirements.txt | 9 ++++----- 6 files changed, 13 insertions(+), 26 deletions(-) diff --git a/frameworks/Python/django/benchmark_config.json b/frameworks/Python/django/benchmark_config.json index 47ff6ff7135..c4e3d51a143 100644 --- a/frameworks/Python/django/benchmark_config.json +++ b/frameworks/Python/django/benchmark_config.json @@ -17,7 +17,7 @@ "flavor": "Python3", "orm": "Full", "platform": "WSGI", - "webserver": "Meinheld", + "webserver": "Gunicorn", "os": "Linux", "database_os": "Linux", "display_name": "Django", @@ -77,7 +77,7 @@ "flavor": "Python3", "orm": "Full", "platform": "WSGI", - "webserver": "Meinheld", + "webserver": "Gunicorn", "os": "Linux", "database_os": "Linux", "display_name": "Django [Postgres]", diff --git a/frameworks/Python/django/django-postgresql.dockerfile b/frameworks/Python/django/django-postgresql.dockerfile index 51870d2750d..ff554710097 100644 --- a/frameworks/Python/django/django-postgresql.dockerfile +++ b/frameworks/Python/django/django-postgresql.dockerfile @@ -1,4 +1,4 @@ -FROM python:3.9-bullseye +FROM python:3.12-bullseye ADD ./ /django diff --git a/frameworks/Python/django/django.dockerfile b/frameworks/Python/django/django.dockerfile index 261bd05fa12..a5b5182eabf 100644 --- a/frameworks/Python/django/django.dockerfile +++ b/frameworks/Python/django/django.dockerfile @@ -1,4 +1,4 @@ -FROM python:3.9-bullseye +FROM python:3.12-bullseye ADD ./ /django diff --git a/frameworks/Python/django/gunicorn_conf.py b/frameworks/Python/django/gunicorn_conf.py index 356e04d1d4a..c6848f685b7 100644 --- a/frameworks/Python/django/gunicorn_conf.py +++ b/frameworks/Python/django/gunicorn_conf.py @@ -5,7 +5,7 @@ _is_pypy = hasattr(sys, 'pypy_version_info') _is_travis = os.environ.get('TRAVIS') == 'true' -workers = int(multiprocessing.cpu_count() * 2.5) +workers = int(multiprocessing.cpu_count()) if _is_travis: workers = 2 @@ -14,16 +14,4 @@ errorlog = '-' pidfile = 'gunicorn.pid' pythonpath = 'hello' - -if _is_pypy: - worker_class = "sync" -else: - worker_class = "meinheld.gmeinheld.MeinheldWorker" - - def post_fork(server, worker): - import meinheld - import meinheld.server - import meinheld.patch - meinheld.server.set_access_logger(None) - meinheld.set_keepalive(keepalive) - meinheld.patch.patch_all() +worker_class = 'sync' \ No newline at end of file diff --git a/frameworks/Python/django/requirements-gunicorn.txt b/frameworks/Python/django/requirements-gunicorn.txt index 4dae00dbf65..7ec2e47c136 100644 --- a/frameworks/Python/django/requirements-gunicorn.txt +++ b/frameworks/Python/django/requirements-gunicorn.txt @@ -1,4 +1,4 @@ -r requirements.txt -greenlet==0.4.17 -gunicorn==20.1.0 -meinheld==1.0.2 +greenlet==3.1.1 +gunicorn==21.2.0 +gevent==24.10.2 \ No newline at end of file diff --git a/frameworks/Python/django/requirements.txt b/frameworks/Python/django/requirements.txt index d5f982d585e..c7765c2c549 100644 --- a/frameworks/Python/django/requirements.txt +++ b/frameworks/Python/django/requirements.txt @@ -1,6 +1,5 @@ Django==3.2.25 -mysqlclient==1.4.6 -psycopg2==2.9.6; implementation_name=='cpython' -psycopg2cffi==2.9.0; implementation_name=='pypy' -pytz==2020.4 -ujson==5.4.0 +mysqlclient==2.2.6 +psycopg2==2.9.9; implementation_name=='cpython' +pytz==2023.2 +ujson==5.8.0 From b44e41aaeb4132a6696ac722e251a2a54913dad8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 20 Mar 2025 18:54:15 +0000 Subject: [PATCH 29/39] Bump github.com/redis/go-redis/v9 in /frameworks/Go/goravel/src/gin Bumps [github.com/redis/go-redis/v9](https://github.com/redis/go-redis) from 9.5.3 to 9.5.5. - [Release notes](https://github.com/redis/go-redis/releases) - [Changelog](https://github.com/redis/go-redis/blob/master/CHANGELOG.md) - [Commits](https://github.com/redis/go-redis/compare/v9.5.3...v9.5.5) --- updated-dependencies: - dependency-name: github.com/redis/go-redis/v9 dependency-type: indirect ... Signed-off-by: dependabot[bot] --- frameworks/Go/goravel/src/gin/go.mod | 2 +- frameworks/Go/goravel/src/gin/go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/frameworks/Go/goravel/src/gin/go.mod b/frameworks/Go/goravel/src/gin/go.mod index e010a6645c6..8547a95c5d3 100644 --- a/frameworks/Go/goravel/src/gin/go.mod +++ b/frameworks/Go/goravel/src/gin/go.mod @@ -122,7 +122,7 @@ require ( github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/pterm/pterm v0.12.79 // indirect github.com/rabbitmq/amqp091-go v1.9.0 // indirect - github.com/redis/go-redis/v9 v9.5.3 // indirect + github.com/redis/go-redis/v9 v9.5.5 // indirect github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect github.com/rifflock/lfshook v0.0.0-20180920164130-b9218ef580f5 // indirect github.com/rivo/uniseg v0.4.7 // indirect diff --git a/frameworks/Go/goravel/src/gin/go.sum b/frameworks/Go/goravel/src/gin/go.sum index fefa43c5558..8318d8ee4d8 100644 --- a/frameworks/Go/goravel/src/gin/go.sum +++ b/frameworks/Go/goravel/src/gin/go.sum @@ -566,8 +566,8 @@ github.com/rabbitmq/amqp091-go v1.9.0 h1:qrQtyzB4H8BQgEuJwhmVQqVHB9O4+MNDJCCAcpc github.com/rabbitmq/amqp091-go v1.9.0/go.mod h1:+jPrT9iY2eLjRaMSRHUhc3z14E/l85kv/f+6luSD3pc= github.com/redis/go-redis/v9 v9.0.2/go.mod h1:/xDTe9EF1LM61hek62Poq2nzQSGj0xSrEtEHbBQevps= github.com/redis/go-redis/v9 v9.0.5/go.mod h1:WqMKv5vnQbRuZstUwxQI195wHy+t4PuXDOjzMvcuQHk= -github.com/redis/go-redis/v9 v9.5.3 h1:fOAp1/uJG+ZtcITgZOfYFmTKPE7n4Vclj1wZFgRciUU= -github.com/redis/go-redis/v9 v9.5.3/go.mod h1:hdY0cQFCN4fnSYT6TkisLufl/4W5UIXyv0b/CLO2V2M= +github.com/redis/go-redis/v9 v9.5.5 h1:51VEyMF8eOO+NUHFm8fpg+IOc1xFuFOhxs3R+kPu1FM= +github.com/redis/go-redis/v9 v9.5.5/go.mod h1:hdY0cQFCN4fnSYT6TkisLufl/4W5UIXyv0b/CLO2V2M= github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE= github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= github.com/rifflock/lfshook v0.0.0-20180920164130-b9218ef580f5 h1:mZHayPoR0lNmnHyvtYjDeq0zlVHn9K/ZXoy17ylucdo= From 508fb38f4a49e9a5b886020b395966c7ce236958 Mon Sep 17 00:00:00 2001 From: Petrik de Heus Date: Fri, 21 Mar 2025 01:05:17 +0100 Subject: [PATCH 30/39] [rails] Don't use a logger (#9696) Not using a logger is faster than setting the log level to fatal. +----------------+------+-----+-----+------+-------+---------+------------+--------------+ | branch_name| json| db|query|update|fortune|plaintext|cached-query|weighted_score| +----------------+------+-----+-----+------+-------+---------+------------+--------------+ | master|152537|33415|28714| 13947| 20249| 186596| 27632| 1901| |rails/nil-logger|157689|34283|30021| 15317| 21485| 184987| 26848| 2034| +----------------+------+-----+-----+------+-------+---------+------------+--------------+ --- frameworks/Ruby/rails/config/environments/production.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frameworks/Ruby/rails/config/environments/production.rb b/frameworks/Ruby/rails/config/environments/production.rb index 331a2687e8f..b84b2807e96 100644 --- a/frameworks/Ruby/rails/config/environments/production.rb +++ b/frameworks/Ruby/rails/config/environments/production.rb @@ -36,7 +36,7 @@ # Log to STDOUT with the current request id as a default log tag. # config.log_tags = [ :request_id ] - config.logger = ActiveSupport::TaggedLogging.logger(STDOUT) + config.logger = nil # Change to "debug" to log everything (including potentially personally-identifiable information!) config.log_level = :fatal From 00a00a953b055883483870bbc8620452bf6c3be0 Mon Sep 17 00:00:00 2001 From: Petrik de Heus Date: Fri, 21 Mar 2025 18:03:55 +0100 Subject: [PATCH 31/39] [rust/roa] Remove Roa (#9698) Roa has been failing for more than a year: https://tfb-status.techempower.com/results/1d6a0f6b-7106-4aa1-8341-63d4bd23779f The project repo hasn't seen any updates in 3 years: https://github.com/Hexilee/roa --- frameworks/Rust/roa/.env | 1 - frameworks/Rust/roa/Cargo.toml | 46 -------- frameworks/Rust/roa/README.md | 111 ------------------ frameworks/Rust/roa/benchmark_config.json | 119 ------------------- frameworks/Rust/roa/config.toml | 86 -------------- frameworks/Rust/roa/roa-core.dockerfile | 13 --- frameworks/Rust/roa/roa-diesel.dockerfile | 13 --- frameworks/Rust/roa/roa-pg.dockerfile | 13 --- frameworks/Rust/roa/roa-sqlx.dockerfile | 13 --- frameworks/Rust/roa/roa-tokio.dockerfile | 13 --- frameworks/Rust/roa/roa.dockerfile | 13 --- frameworks/Rust/roa/rustfmt.toml | 2 - frameworks/Rust/roa/src/db_diesel.rs | 97 ---------------- frameworks/Rust/roa/src/db_pg.rs | 126 --------------------- frameworks/Rust/roa/src/db_sqlx.rs | 108 ------------------ frameworks/Rust/roa/src/endpoints.rs | 23 ---- frameworks/Rust/roa/src/main-core.rs | 44 ------- frameworks/Rust/roa/src/main-db.rs | 118 ------------------- frameworks/Rust/roa/src/main.rs | 34 ------ frameworks/Rust/roa/src/models.rs | 30 ----- frameworks/Rust/roa/src/schema.rs | 15 --- frameworks/Rust/roa/src/utils.rs | 20 ---- frameworks/Rust/roa/templates/fortune.html | 12 -- 23 files changed, 1070 deletions(-) delete mode 100644 frameworks/Rust/roa/.env delete mode 100644 frameworks/Rust/roa/Cargo.toml delete mode 100755 frameworks/Rust/roa/README.md delete mode 100755 frameworks/Rust/roa/benchmark_config.json delete mode 100644 frameworks/Rust/roa/config.toml delete mode 100644 frameworks/Rust/roa/roa-core.dockerfile delete mode 100644 frameworks/Rust/roa/roa-diesel.dockerfile delete mode 100644 frameworks/Rust/roa/roa-pg.dockerfile delete mode 100644 frameworks/Rust/roa/roa-sqlx.dockerfile delete mode 100644 frameworks/Rust/roa/roa-tokio.dockerfile delete mode 100644 frameworks/Rust/roa/roa.dockerfile delete mode 100644 frameworks/Rust/roa/rustfmt.toml delete mode 100644 frameworks/Rust/roa/src/db_diesel.rs delete mode 100644 frameworks/Rust/roa/src/db_pg.rs delete mode 100644 frameworks/Rust/roa/src/db_sqlx.rs delete mode 100644 frameworks/Rust/roa/src/endpoints.rs delete mode 100644 frameworks/Rust/roa/src/main-core.rs delete mode 100644 frameworks/Rust/roa/src/main-db.rs delete mode 100644 frameworks/Rust/roa/src/main.rs delete mode 100644 frameworks/Rust/roa/src/models.rs delete mode 100644 frameworks/Rust/roa/src/schema.rs delete mode 100644 frameworks/Rust/roa/src/utils.rs delete mode 100644 frameworks/Rust/roa/templates/fortune.html diff --git a/frameworks/Rust/roa/.env b/frameworks/Rust/roa/.env deleted file mode 100644 index 3a9b68230d3..00000000000 --- a/frameworks/Rust/roa/.env +++ /dev/null @@ -1 +0,0 @@ -DATABASE_URL="postgres://benchmarkdbuser:benchmarkdbpass@tfb-database/hello_world" \ No newline at end of file diff --git a/frameworks/Rust/roa/Cargo.toml b/frameworks/Rust/roa/Cargo.toml deleted file mode 100644 index d65ecf208b8..00000000000 --- a/frameworks/Rust/roa/Cargo.toml +++ /dev/null @@ -1,46 +0,0 @@ -[package] -name = "roa-techempower" -version = "0.1.0" -edition = "2018" -publish = false - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[[bin]] -name = "roa" -path = "src/main.rs" - -[[bin]] -name = "roa-db" -path = "src/main-db.rs" - -[[bin]] -name = "roa-core" -path = "src/main-core.rs" - -[dependencies] -roa = { version = "0.5.0", features = ["json", "template", "router"] } -roa-diesel = { version = "0.5.0", optional = true } -roa-pg = { version = "0.5.0", optional = true } -roa-tokio = { version = "0.5.0", optional = true } -async-std = { version = "1.5", features = ["attributes"] } -askama = "0.9" -serde = { version = "1.0", features = ["derive"] } -serde_json = "1.0" -rand = { version = "0.7", features = ["small_rng"] } -bytes = "0.5.3" -futures = "0.3.4" -http = "0.2" -lazy_static = "1.4.0" -dotenv_codegen = "0.15.0" - -tokio = { version = "0.2.13", features = ["full"], optional = true } -diesel = { version = "1.4.3", features = ["postgres"], optional = true } -sqlx = { version = "0.2", features = ["postgres"], optional = true } -#hyper = "0.13" - -[features] -orm = ["diesel", "roa-diesel"] -pg = ["roa-pg"] -sqlx-pg = ["sqlx"] -tokio_rt = ["tokio", "roa-tokio"] diff --git a/frameworks/Rust/roa/README.md b/frameworks/Rust/roa/README.md deleted file mode 100755 index 4653b4c3dba..00000000000 --- a/frameworks/Rust/roa/README.md +++ /dev/null @@ -1,111 +0,0 @@ -
-

Roa

-

Roa is an async web framework inspired by koajs, lightweight but powerful.

-

- -[![Stable Test](https://github.com/Hexilee/roa/workflows/Stable%20Test/badge.svg)](https://github.com/Hexilee/roa/actions) -[![codecov](https://codecov.io/gh/Hexilee/roa/branch/master/graph/badge.svg)](https://codecov.io/gh/Hexilee/roa) -[![wiki](https://img.shields.io/badge/roa-wiki-purple.svg)](https://github.com/Hexilee/roa/wiki) -[![Rust Docs](https://docs.rs/roa/badge.svg)](https://docs.rs/roa) -[![Crate version](https://img.shields.io/crates/v/roa.svg)](https://crates.io/crates/roa) -[![Download](https://img.shields.io/crates/d/roa.svg)](https://crates.io/crates/roa) -[![Version](https://img.shields.io/badge/rustc-1.40+-lightgray.svg)](https://blog.rust-lang.org/2019/12/19/Rust-1.40.0.html) -[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/Hexilee/roa/blob/master/LICENSE) - -

- -

- Examples - | - Guide - | - Cookbook -

-
-
- - -#### Feature highlights - -- A lightweight, solid and well extensible core. - - Supports HTTP/1.x and HTTP/2.0 protocols. - - Full streaming. - - Highly extensible middleware system. - - Based on [`hyper`](https://github.com/hyperium/hyper), runtime-independent, you can chose async runtime as you like. -- Many useful extensions. - - Official runtime schemes: - - [async-std](https://github.com/async-rs/async-std) runtime and TcpStream; - - [tokio](https://github.com/tokio-rs/tokio) runtime and TcpStream. - - Transparent content compression (br, gzip, deflate, zstd). - - Configurable and nestable router. - - Named uri parameters(query and router parameter). - - Cookie and jwt support. - - HTTPS support. - - WebSocket support. - - Asynchronous multipart form support. - - Other middlewares(logger, CORS .etc). -- Integrations - - roa-diesel, integration with [diesel](https://github.com/diesel-rs/diesel). - - roa-juniper, integration with [juniper](https://github.com/graphql-rust/juniper). - - roa-pg, integration with [tokio-postgres](https://crates.io/crates/tokio-postgres). -- Works on stable Rust. - -#### Get start - -```text -# Cargo.toml - -[dependencies] -roa = "0.5.0" -async-std = { version = "1.5", features = ["attributes"] } -``` - -```rust,no_run -use roa::App; -use roa::preload::*; -use std::error::Error as StdError; - -#[async_std::main] -async fn main() -> Result<(), Box> { - let app = App::new().end("Hello, World"); - app.listen("127.0.0.1:8000", |addr| { - println!("Server is listening on {}", addr) - })? - .await?; - Ok(()) -} -``` -Refer to [wiki](https://github.com/Hexilee/roa/wiki) for more details. - -## Database - -PostgreSQL. - -* [diesel](http://diesel.rs) \/ [tokio-postgres](https://crates.io/crates/tokio-postgres) \/ [sqlx](https://github.com/launchbadge/sqlx) - -## Test URLs - -### Test 1: JSON Encoding - - http://localhost:8080/json - -### Test 2: Single Row Query - - http://localhost:8080/db - -### Test 3: Multi Row Query - - http://localhost:8080/queries?q=20 - -### Test 4: Fortunes (Template rendering) - - http://localhost:8080/fortune - -### Test 5: Update Query - - http://localhost:8080/updates?q=20 - -### Test 6: Plaintext - - http://localhost:8080/plaintext - diff --git a/frameworks/Rust/roa/benchmark_config.json b/frameworks/Rust/roa/benchmark_config.json deleted file mode 100755 index b60fbac4858..00000000000 --- a/frameworks/Rust/roa/benchmark_config.json +++ /dev/null @@ -1,119 +0,0 @@ -{ - "framework": "roa", - "tests": [{ - "default": { - "json_url": "/json", - "plaintext_url": "/plaintext", - "port": 8080, - "approach": "Realistic", - "classification": "Micro", - "database": "Postgres", - "framework": "roa", - "language": "Rust", - "orm": "Raw", - "platform": "None", - "webserver": "hyper", - "os": "Linux", - "database_os": "Linux", - "display_name": "Roa", - "notes": "", - "versus": "" - }, - "core": { - "json_url": "/json", - "plaintext_url": "/plaintext", - "port": 8080, - "approach": "Realistic", - "classification": "Micro", - "database": "Postgres", - "framework": "roa", - "language": "Rust", - "orm": "Raw", - "platform": "None", - "webserver": "hyper", - "os": "Linux", - "database_os": "Linux", - "display_name": "Roa [Core]", - "notes": "", - "versus": "" - }, - "tokio": { - "json_url": "/json", - "plaintext_url": "/plaintext", - "port": 8080, - "approach": "Realistic", - "classification": "Micro", - "database": "Postgres", - "framework": "roa", - "language": "Rust", - "orm": "Raw", - "platform": "None", - "webserver": "hyper", - "os": "Linux", - "database_os": "Linux", - "display_name": "Roa [Tokio]", - "notes": "", - "versus": "" - }, - "diesel": { - "db_url": "/db", - "fortune_url": "/fortunes", - "query_url": "/queries?q=", - "update_url": "/updates?q=", - "port": 8080, - "approach": "Realistic", - "classification": "Micro", - "database": "Postgres", - "framework": "roa", - "language": "Rust", - "orm": "Full", - "platform": "None", - "webserver": "hyper", - "os": "Linux", - "database_os": "Linux", - "display_name": "Roa [Diesel]", - "notes": "", - "versus": "" - }, - "pg": { - "db_url": "/db", - "fortune_url": "/fortunes", - "query_url": "/queries?q=", - "update_url": "/updates?q=", - "port": 8080, - "approach": "Realistic", - "classification": "Micro", - "database": "Postgres", - "framework": "roa", - "language": "Rust", - "orm": "Raw", - "platform": "None", - "webserver": "hyper", - "os": "Linux", - "database_os": "Linux", - "display_name": "Roa [Postgres]", - "notes": "", - "versus": "" - }, - "sqlx": { - "db_url": "/db", - "fortune_url": "/fortunes", - "query_url": "/queries?q=", - "update_url": "/updates?q=", - "port": 8080, - "approach": "Realistic", - "classification": "Micro", - "database": "Postgres", - "framework": "roa", - "language": "Rust", - "orm": "Raw", - "platform": "None", - "webserver": "hyper", - "os": "Linux", - "database_os": "Linux", - "display_name": "Roa [Sqlx]", - "notes": "", - "versus": "" - } - }] -} \ No newline at end of file diff --git a/frameworks/Rust/roa/config.toml b/frameworks/Rust/roa/config.toml deleted file mode 100644 index 196983fba0a..00000000000 --- a/frameworks/Rust/roa/config.toml +++ /dev/null @@ -1,86 +0,0 @@ -[framework] -name = "roa" - -[sqlx] -urls.db = "/db" -urls.query = "/queries?q=" -urls.update = "/updates?q=" -urls.fortune = "/fortune" -approach = "Realistic" -classification = "Micro" -database = "Postgres" -database_os = "Linux" -os = "Linux" -orm = "Raw" -platform = "None" -webserver = "hyper" -versus = "" - -[core] -urls.plaintext = "/plaintext" -urls.json = "/json" -approach = "Realistic" -classification = "Micro" -database = "Postgres" -database_os = "Linux" -os = "Linux" -orm = "Raw" -platform = "None" -webserver = "hyper" -versus = "" - -[main] -urls.plaintext = "/plaintext" -urls.json = "/json" -approach = "Realistic" -classification = "Micro" -database = "Postgres" -database_os = "Linux" -os = "Linux" -orm = "Raw" -platform = "None" -webserver = "hyper" -versus = "" - -[diesel] -urls.db = "/db" -urls.query = "/queries?q=" -urls.update = "/updates?q=" -urls.fortune = "/fortune" -approach = "Realistic" -classification = "Micro" -database = "Postgres" -database_os = "Linux" -os = "Linux" -orm = "Full" -platform = "None" -webserver = "hyper" -versus = "" - -[pg] -urls.db = "/db" -urls.query = "/queries?q=" -urls.update = "/updates?q=" -urls.fortune = "/fortune" -approach = "Realistic" -classification = "Micro" -database = "Postgres" -database_os = "Linux" -os = "Linux" -orm = "Raw" -platform = "None" -webserver = "hyper" -versus = "" - -[tokio] -urls.plaintext = "/plaintext" -urls.json = "/json" -approach = "Realistic" -classification = "Micro" -database = "Postgres" -database_os = "Linux" -os = "Linux" -orm = "Raw" -platform = "None" -webserver = "hyper" -versus = "" diff --git a/frameworks/Rust/roa/roa-core.dockerfile b/frameworks/Rust/roa/roa-core.dockerfile deleted file mode 100644 index e77098a5a32..00000000000 --- a/frameworks/Rust/roa/roa-core.dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -FROM rust:1.73 - -RUN apt-get update -yqq && apt-get install -yqq cmake g++ - -ADD ./ /roa -WORKDIR /roa - -RUN cargo clean -RUN RUSTFLAGS="-C target-cpu=native" cargo build --release --bin roa-core - -EXPOSE 8080 - -CMD ./target/release/roa-core diff --git a/frameworks/Rust/roa/roa-diesel.dockerfile b/frameworks/Rust/roa/roa-diesel.dockerfile deleted file mode 100644 index 35d7aa3507a..00000000000 --- a/frameworks/Rust/roa/roa-diesel.dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -FROM rust:1.73 - -RUN apt-get update -yqq && apt-get install -yqq cmake g++ - -ADD ./ /roa -WORKDIR /roa - -RUN cargo clean -RUN RUSTFLAGS="-C target-cpu=native" cargo build --release --bin roa-db --features "orm" - -EXPOSE 8080 - -CMD ./target/release/roa-db diff --git a/frameworks/Rust/roa/roa-pg.dockerfile b/frameworks/Rust/roa/roa-pg.dockerfile deleted file mode 100644 index beb9d673858..00000000000 --- a/frameworks/Rust/roa/roa-pg.dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -FROM rust:1.73 - -RUN apt-get update -yqq && apt-get install -yqq cmake g++ - -ADD ./ /roa -WORKDIR /roa - -RUN cargo clean -RUN RUSTFLAGS="-C target-cpu=native" cargo build --release --bin roa-db --features "pg" - -EXPOSE 8080 - -CMD ./target/release/roa-db diff --git a/frameworks/Rust/roa/roa-sqlx.dockerfile b/frameworks/Rust/roa/roa-sqlx.dockerfile deleted file mode 100644 index f14a42dc735..00000000000 --- a/frameworks/Rust/roa/roa-sqlx.dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -FROM rust:1.73 - -RUN apt-get update -yqq && apt-get install -yqq cmake g++ - -ADD ./ /roa -WORKDIR /roa - -RUN cargo clean -RUN RUSTFLAGS="-C target-cpu=native" cargo build --release --bin roa-db --features "sqlx-pg" - -EXPOSE 8080 - -CMD ./target/release/roa-db diff --git a/frameworks/Rust/roa/roa-tokio.dockerfile b/frameworks/Rust/roa/roa-tokio.dockerfile deleted file mode 100644 index 38f3b9fa381..00000000000 --- a/frameworks/Rust/roa/roa-tokio.dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -FROM rust:1.73 - -RUN apt-get update -yqq && apt-get install -yqq cmake g++ - -ADD ./ /roa -WORKDIR /roa - -RUN cargo clean -RUN RUSTFLAGS="-C target-cpu=native" cargo build --release --bin roa-core --features "tokio_rt" - -EXPOSE 8080 - -CMD ./target/release/roa-core diff --git a/frameworks/Rust/roa/roa.dockerfile b/frameworks/Rust/roa/roa.dockerfile deleted file mode 100644 index 29ed4e2200f..00000000000 --- a/frameworks/Rust/roa/roa.dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -FROM rust:1.73 - -RUN apt-get update -yqq && apt-get install -yqq cmake g++ - -ADD ./ /roa -WORKDIR /roa - -RUN cargo clean -RUN RUSTFLAGS="-C target-cpu=native" cargo build --release --bin roa - -EXPOSE 8080 - -CMD ./target/release/roa diff --git a/frameworks/Rust/roa/rustfmt.toml b/frameworks/Rust/roa/rustfmt.toml deleted file mode 100644 index 30e2708ff60..00000000000 --- a/frameworks/Rust/roa/rustfmt.toml +++ /dev/null @@ -1,2 +0,0 @@ -max_width = 89 -reorder_imports = true \ No newline at end of file diff --git a/frameworks/Rust/roa/src/db_diesel.rs b/frameworks/Rust/roa/src/db_diesel.rs deleted file mode 100644 index 9a311adf00a..00000000000 --- a/frameworks/Rust/roa/src/db_diesel.rs +++ /dev/null @@ -1,97 +0,0 @@ -use diesel::pg::PgConnection; -use diesel::prelude::*; -use diesel::r2d2::ConnectionManager; -use roa::http::StatusCode; -use roa_diesel::preload::*; -use roa_diesel::Pool; - -use rand::rngs::SmallRng; -use rand::{Rng, SeedableRng}; - -use crate::models::Fortune; -use crate::{async_trait, throw, Context, Result, Service, StdResult, World}; -use futures::stream::{FuturesUnordered, TryStreamExt}; - -#[derive(Clone)] -pub struct State { - pool: Pool, - rng: SmallRng, -} - -impl AsRef> for State { - #[inline] - fn as_ref(&self) -> &Pool { - &self.pool - } -} - -impl State { - pub async fn bind(pg_url: &str) -> StdResult { - let pool = Pool::builder() - .max_size(50) - .build(ConnectionManager::::new(pg_url))?; - Ok(Self { - pool, - rng: SmallRng::from_entropy(), - }) - } -} - -#[async_trait(?Send)] -impl Service for Context { - #[inline] - fn random_id(&mut self) -> i32 { - self.rng.gen_range(0, 10_001) - } - - #[inline] - fn get_queries(&self) -> usize { - use std::cmp::{max, min}; - let query = self.uri().query(); - let nums = query - .and_then(|query| Some((query, query.find("q")?))) - .and_then(|(query, pos)| query.split_at(pos + 2).1.parse().ok()) - .unwrap_or(1); - min(500, max(1, nums)) - } - - #[inline] - async fn query_world(&self, wid: i32) -> Result { - use crate::schema::world::dsl::*; - let data = self.first(world.filter(id.eq(wid))).await?; - match data { - None => throw!(StatusCode::NOT_FOUND), - Some(item) => Ok(item), - } - } - - #[inline] - async fn fortunes(&self) -> Result> { - use crate::schema::fortune::dsl::*; - Ok(self.load_data(fortune).await?) - } - - #[inline] - async fn update_worlds(&mut self) -> Result> { - let worlds = FuturesUnordered::new(); - let random_ids: Vec<_> = - (0..self.get_queries()).map(|_| self.random_id()).collect(); - for wid in random_ids { - worlds.push(update_world(self, wid)); - } - worlds.try_collect().await - } -} - -async fn update_world(ctx: &Context, wid: i32) -> Result { - use crate::schema::world::dsl::*; - let mut data = ctx.query_world(wid).await?; - data.randomnumber = wid; - ctx.execute( - diesel::update(world) - .filter(id.eq(wid)) - .set(randomnumber.eq(wid)), - ) - .await?; - Ok(data) -} diff --git a/frameworks/Rust/roa/src/db_pg.rs b/frameworks/Rust/roa/src/db_pg.rs deleted file mode 100644 index e2e3435af5a..00000000000 --- a/frameworks/Rust/roa/src/db_pg.rs +++ /dev/null @@ -1,126 +0,0 @@ -use crate::models::Fortune; -use crate::{async_trait, throw, Context, Result, Service, StdResult, World}; -use rand::rngs::SmallRng; -use rand::{Rng, SeedableRng}; -use roa::http::StatusCode; -use roa_pg::types::ToSql; -use roa_pg::{connect, Client, Statement}; -use std::collections::HashMap; -use std::fmt::Write; -use std::sync::Arc; - -#[derive(Clone)] -pub struct State { - client: Arc, - queries: Arc, - rng: SmallRng, -} - -pub struct Queries { - fortune: Statement, - world: Statement, - updates: HashMap, -} - -impl State { - pub async fn bind(url: &str) -> StdResult { - let (client, conn) = connect(&url.parse()?).await?; - - async_std::task::spawn(conn); - - let fortune = client.prepare("SELECT * FROM fortune").await?; - let world = client.prepare("SELECT * FROM world WHERE id=$1").await?; - let mut updates = HashMap::new(); - for num in 1..=500 { - let mut pl = 1; - let mut q = String::new(); - q.push_str("UPDATE world SET randomnumber = CASE id "); - for _ in 1..=num { - write!(&mut q, "when ${} then ${} ", pl, pl + 1)?; - pl += 2; - } - q.push_str("ELSE randomnumber END WHERE id IN ("); - for _ in 1..=num { - write!(&mut q, "${},", pl)?; - pl += 1; - } - q.pop(); - q.push(')'); - updates.insert(num, client.prepare(&q).await?); - } - Ok(State { - client: Arc::new(client), - queries: Arc::new(Queries { - fortune, - world, - updates, - }), - rng: SmallRng::from_entropy(), - }) - } -} - -#[async_trait(?Send)] -impl Service for Context { - #[inline] - fn random_id(&mut self) -> i32 { - self.rng.gen_range(0, 10_001) - } - - #[inline] - fn get_queries(&self) -> usize { - use std::cmp::{max, min}; - let query = self.uri().query(); - let nums = query - .and_then(|query| Some((query, query.find("q")?))) - .and_then(|(query, pos)| query.split_at(pos + 2).1.parse().ok()) - .unwrap_or(1); - min(500, max(1, nums)) - } - - #[inline] - async fn query_world(&self, wid: i32) -> Result { - match self.client.query_opt(&self.queries.world, &[&wid]).await? { - None => throw!(StatusCode::NOT_FOUND), - Some(row) => Ok(World { - id: row.get(0), - randomnumber: row.get(1), - }), - } - } - - #[inline] - async fn fortunes(&self) -> Result> { - let fortunes = self - .client - .query(&self.queries.fortune, &[]) - .await? - .iter() - .map(|row| Fortune { - id: row.get(0), - message: row.get(1), - }) - .collect(); - Ok(fortunes) - } - - #[inline] - async fn update_worlds(&mut self) -> Result> { - let mut worlds = self.query_worlds().await?; - let nums = worlds.len(); - let mut params: Vec<&(dyn ToSql + Sync)> = Vec::with_capacity(nums * 3); - for w in worlds.iter_mut() { - w.randomnumber = w.id; - } - for w in &worlds { - params.push(&w.id); - params.push(&w.randomnumber); - } - for w in &worlds { - params.push(&w.id); - } - let statement = &self.queries.updates[&nums]; - self.client.execute(statement, ¶ms).await?; - Ok(worlds) - } -} diff --git a/frameworks/Rust/roa/src/db_sqlx.rs b/frameworks/Rust/roa/src/db_sqlx.rs deleted file mode 100644 index 731f3dd7445..00000000000 --- a/frameworks/Rust/roa/src/db_sqlx.rs +++ /dev/null @@ -1,108 +0,0 @@ -use crate::models::Fortune; -use crate::{async_trait, throw, Context, Result, Service, StdResult, World}; -use futures::TryStreamExt; -use rand::rngs::SmallRng; -use rand::{Rng, SeedableRng}; -use roa::http::StatusCode; -use sqlx::{PgPool, Row}; -use std::collections::HashMap; -use std::fmt::Write; -use std::sync::Arc; - -#[derive(Clone)] -pub struct State { - client: PgPool, - updates: Arc>, - rng: SmallRng, -} - -impl State { - pub async fn bind(url: &str) -> StdResult { - let client = PgPool::new(url).await?; - let mut updates = HashMap::new(); - for num in 1..=500 { - let mut pl = 1; - let mut q = String::new(); - q.push_str("UPDATE world SET randomnumber = CASE id "); - for _ in 1..=num { - write!(&mut q, "when ${} then ${} ", pl, pl + 1)?; - pl += 2; - } - q.push_str("ELSE randomnumber END WHERE id IN ("); - for _ in 1..=num { - write!(&mut q, "${},", pl)?; - pl += 1; - } - q.pop(); - q.push(')'); - updates.insert(num, q); - } - Ok(State { - client, - updates: Arc::new(updates), - rng: SmallRng::from_entropy(), - }) - } -} - -#[async_trait(?Send)] -impl Service for Context { - #[inline] - fn random_id(&mut self) -> i32 { - self.rng.gen_range(0, 10_001) - } - - #[inline] - fn get_queries(&self) -> usize { - use std::cmp::{max, min}; - let query = self.uri().query(); - let nums = query - .and_then(|query| Some((query, query.find("q")?))) - .and_then(|(query, pos)| query.split_at(pos + 2).1.parse().ok()) - .unwrap_or(1); - min(500, max(1, nums)) - } - - #[inline] - async fn query_world(&self, wid: i32) -> Result { - match sqlx::query("SELECT * FROM world WHERE id=$1") - .bind(wid) - .fetch_optional(&mut &self.client) - .await? - { - None => throw!(StatusCode::NOT_FOUND), - Some(row) => Ok(World { - id: row.get(0), - randomnumber: row.get(1), - }), - } - } - - #[inline] - async fn fortunes(&self) -> Result> { - let fortunes: Vec<_> = sqlx::query("SELECT * FROM fortune") - .fetch(&mut &self.client) - .map_ok(|row| Fortune { - id: row.get(0), - message: row.get(1), - }) - .try_collect() - .await?; - Ok(fortunes) - } - - #[inline] - async fn update_worlds(&mut self) -> Result> { - let mut worlds = self.query_worlds().await?; - let mut query = sqlx::query(&self.updates[&worlds.len()]); - for w in worlds.iter_mut() { - w.randomnumber = w.id; - query = query.bind(w.id).bind(w.randomnumber); - } - for w in &worlds { - query = query.bind(w.id); - } - query.execute(&mut &self.client).await?; - Ok(worlds) - } -} diff --git a/frameworks/Rust/roa/src/endpoints.rs b/frameworks/Rust/roa/src/endpoints.rs deleted file mode 100644 index 1d5363d3cce..00000000000 --- a/frameworks/Rust/roa/src/endpoints.rs +++ /dev/null @@ -1,23 +0,0 @@ -use crate::utils::{Message, JSON_LEN, PLAINTEXT_LEN}; -use roa::http::header::CONTENT_LENGTH; -use roa::preload::*; -use roa::{Context, Result}; - -static HELLO_WORLD: &str = "Hello, World!"; - -#[inline] -pub async fn json(ctx: &mut Context) -> Result { - ctx.resp.headers.insert(CONTENT_LENGTH, JSON_LEN.clone()); - ctx.write_json(&Message { - message: HELLO_WORLD, - }) -} - -#[inline] -pub async fn plaintext(ctx: &mut Context) -> Result { - ctx.resp - .headers - .insert(CONTENT_LENGTH, PLAINTEXT_LEN.clone()); - ctx.write(HELLO_WORLD); - Ok(()) -} diff --git a/frameworks/Rust/roa/src/main-core.rs b/frameworks/Rust/roa/src/main-core.rs deleted file mode 100644 index fb82662a47b..00000000000 --- a/frameworks/Rust/roa/src/main-core.rs +++ /dev/null @@ -1,44 +0,0 @@ -use roa::http::header::SERVER; -use roa::{App, Context, Result}; -use std::error::Error as StdError; -use std::result::Result as StdResult; - -pub mod endpoints; -pub mod utils; -use endpoints::{json, plaintext}; -use utils::SERVER_HEADER; - -#[inline] -async fn endpoint(ctx: &mut Context<()>) -> Result { - // avoid to re-allocate a header map - ctx.resp.headers = std::mem::take(&mut ctx.req.headers); - ctx.resp.headers.clear(); - ctx.resp.headers.insert(SERVER, SERVER_HEADER.clone()); - match ctx.uri().path() { - "/plaintext" => plaintext(ctx).await, - _ => json(ctx).await, - } -} - -#[cfg(not(feature = "tokio_rt"))] -#[async_std::main] -async fn main() -> StdResult<(), Box> { - use roa::preload::*; - let app = App::new().end(endpoint); - app.listen("0.0.0.0:8080", |addr| { - println!("Server listen on {}...", addr); - })? - .await?; - Ok(()) -} - -#[cfg(feature = "tokio_rt")] -#[tokio::main] -async fn main() -> StdResult<(), Box> { - use roa_tokio::{Exec, TcpIncoming}; - let app = App::with_exec((), Exec).end(endpoint); - let incoming = TcpIncoming::bind("0.0.0.0:8080")?; - println!("Server listen on {}...", incoming.local_addr()); - app.accept(incoming).await?; - Ok(()) -} diff --git a/frameworks/Rust/roa/src/main-db.rs b/frameworks/Rust/roa/src/main-db.rs deleted file mode 100644 index acb702c17fd..00000000000 --- a/frameworks/Rust/roa/src/main-db.rs +++ /dev/null @@ -1,118 +0,0 @@ -#[cfg(feature = "orm")] -#[macro_use] -extern crate diesel; - -#[cfg(feature = "orm")] -mod db_diesel; - -#[cfg(feature = "orm")] -mod schema; - -#[cfg(feature = "orm")] -use db_diesel::State; - -#[cfg(feature = "pg")] -mod db_pg; - -#[cfg(feature = "pg")] -use db_pg::State; - -#[cfg(feature = "sqlx-pg")] -mod db_sqlx; - -#[cfg(feature = "sqlx-pg")] -use db_sqlx::State; - -use futures::stream::{FuturesUnordered, TryStreamExt}; -use roa::http::header::SERVER; -use roa::preload::*; -use roa::router::{get, RouteTable, Router}; -use roa::{async_trait, throw, App, Context, Next, Result}; -mod models; -pub mod utils; -use dotenv_codegen::dotenv; -use models::*; -use utils::SERVER_HEADER; - -type StdResult = std::result::Result>; - -#[async_trait(?Send)] -trait Service { - fn random_id(&mut self) -> i32; - fn get_queries(&self) -> usize; - async fn query_world(&self, wid: i32) -> Result; - async fn fortunes(&self) -> Result>; - async fn update_worlds(&mut self) -> Result>; - async fn query_worlds(&mut self) -> Result> { - let worlds = FuturesUnordered::new(); - let random_ids: Vec<_> = - (0..self.get_queries()).map(|_| self.random_id()).collect(); - for id in random_ids { - worlds.push(self.query_world(id)); - } - worlds.try_collect().await - } -} - -#[inline] -async fn gate(ctx: &mut Context, next: Next<'_>) -> Result { - // avoid to re-allocate a header map - ctx.resp.headers = std::mem::take(&mut ctx.req.headers); - ctx.resp.headers.clear(); - ctx.resp.headers.insert(SERVER, SERVER_HEADER.clone()); - next.await -} - -#[inline] -async fn db(ctx: &mut Context) -> Result { - let id = ctx.random_id(); - let data = ctx.query_world(id).await?; - ctx.write_json(&data)?; - Ok(()) -} - -#[inline] -async fn queries(ctx: &mut Context) -> Result { - let data = ctx.query_worlds().await?; - ctx.write_json(&data)?; - Ok(()) -} - -#[inline] -async fn fortune(ctx: &mut Context) -> Result { - let mut fortunes = ctx.fortunes().await?; - fortunes.push(Fortune { - id: 0, - message: "Additional fortune added at request time.".to_owned(), - }); - fortunes.sort_by(|it, next| it.message.cmp(&next.message)); - ctx.render(&Fortunes { items: &fortunes }) -} - -#[inline] -async fn updates(ctx: &mut Context) -> Result { - let data = ctx.update_worlds().await?; - ctx.write_json(&data)?; - Ok(()) -} - -fn routes(prefix: &'static str) -> StdResult> { - Router::new() - .gate(gate) - .on("/db", get(db)) - .on("/queries", get(queries)) - .on("/fortunes", get(fortune)) - .on("/updates", get(updates)) - .routes(prefix) - .map_err(Into::into) -} - -#[async_std::main] -async fn main() -> StdResult<()> { - let app = App::state(State::bind(dotenv!("DATABASE_URL")).await?).end(routes("/")?); - app.listen("0.0.0.0:8080", |addr| { - println!("Server listen on {}...", addr); - })? - .await?; - Ok(()) -} diff --git a/frameworks/Rust/roa/src/main.rs b/frameworks/Rust/roa/src/main.rs deleted file mode 100644 index af49219fe74..00000000000 --- a/frameworks/Rust/roa/src/main.rs +++ /dev/null @@ -1,34 +0,0 @@ -use roa::http::header::SERVER; -use roa::preload::*; -use roa::router::{get, Router}; -use roa::{App, Context, Next, Result}; -use std::error::Error; -use std::result::Result as StdResult; - -pub mod endpoints; -pub mod utils; -use endpoints::{json, plaintext}; -use utils::SERVER_HEADER; - -#[inline] -async fn gate(ctx: &mut Context<()>, next: Next<'_>) -> Result { - // avoid to re-allocate a header map - ctx.resp.headers = std::mem::take(&mut ctx.req.headers); - ctx.resp.headers.clear(); - ctx.resp.headers.insert(SERVER, SERVER_HEADER.clone()); - next.await -} - -#[async_std::main] -async fn main() -> StdResult<(), Box> { - let router = Router::new() - .gate(gate) - .on("/json", get(json)) - .on("/plaintext", get(plaintext)); - let app = App::new().end(router.routes("/")?); - app.listen("0.0.0.0:8080", |addr| { - println!("Server listen on {}...", addr); - })? - .await?; - Ok(()) -} diff --git a/frameworks/Rust/roa/src/models.rs b/frameworks/Rust/roa/src/models.rs deleted file mode 100644 index b45713d536c..00000000000 --- a/frameworks/Rust/roa/src/models.rs +++ /dev/null @@ -1,30 +0,0 @@ -#![allow(dead_code)] - -use askama::Template; -use serde::Serialize; - -#[derive(Serialize)] -pub struct Message { - pub message: &'static str, -} - -#[cfg_attr(feature = "orm", derive(Queryable))] -#[allow(non_snake_case)] -#[derive(Serialize, Debug)] -pub struct World { - pub id: i32, - pub randomnumber: i32, -} - -#[cfg_attr(feature = "orm", derive(Queryable))] -#[derive(Serialize, Debug)] -pub struct Fortune { - pub id: i32, - pub message: String, -} - -#[derive(Template)] -#[template(path = "fortune.html")] -pub struct Fortunes<'a> { - pub items: &'a [Fortune], -} diff --git a/frameworks/Rust/roa/src/schema.rs b/frameworks/Rust/roa/src/schema.rs deleted file mode 100644 index eb14aa98a75..00000000000 --- a/frameworks/Rust/roa/src/schema.rs +++ /dev/null @@ -1,15 +0,0 @@ -#![allow(non_snake_case)] - -table! { - world (id) { - id -> Integer, - randomnumber -> Integer, - } -} - -table! { - fortune (id) { - id -> Integer, - message -> Text, - } -} diff --git a/frameworks/Rust/roa/src/utils.rs b/frameworks/Rust/roa/src/utils.rs deleted file mode 100644 index 34c00037fbc..00000000000 --- a/frameworks/Rust/roa/src/utils.rs +++ /dev/null @@ -1,20 +0,0 @@ -use lazy_static::lazy_static; -use roa::http::header::HeaderValue; -use serde::{Deserialize, Serialize}; - -lazy_static! { - pub static ref SERVER_HEADER: HeaderValue = HeaderValue::from_static("roa"); - pub static ref JSON_LEN: HeaderValue = HeaderValue::from_static("27"); - pub static ref PLAINTEXT_LEN: HeaderValue = HeaderValue::from_static("13"); -} - -#[derive(Serialize, Debug)] -pub struct Fortune { - pub id: i32, - pub message: String, -} - -#[derive(Serialize, Deserialize)] -pub struct Message { - pub message: &'static str, -} diff --git a/frameworks/Rust/roa/templates/fortune.html b/frameworks/Rust/roa/templates/fortune.html deleted file mode 100644 index 7c448b9d999..00000000000 --- a/frameworks/Rust/roa/templates/fortune.html +++ /dev/null @@ -1,12 +0,0 @@ - - - Fortunes - - - - {% for item in items %} - - {% endfor %} -
idmessage
{{item.id}}{{item.message}}
- - From 7865ccc0711e604c79c5aae4c8351077e8a7c2ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=A4=E9=9B=A8=E4=B8=9C?= <83822098+ltpp-universe@users.noreply.github.com> Date: Sat, 22 Mar 2025 01:04:38 +0800 Subject: [PATCH 32/39] Upgrade hyperlane (#9701) * feat: update & fortune * feat: randomNumber * feat: max row 500 * feat: update * feat: Fortune * feat: fortunes * feat: update * feat: update * feat: update * feat: update * feat: fortunes * feat: fortunes * feat: fortunes * feat: fortunes * feat: fortunes * feat: fortunes * feat: update * feat: update * feat: update * feat: update * feat: update * feat: update * feat: update * feat: update * feat: update * feat: update * feat: update * feat: update * feat: update * feat: update * feat: update * feat: update * feat: update * feat: update * feat: update * feat: update * feat: update * feat: update * feat: update * feat: update * feat: update * feat: update * feat: update * feat: cache * feat: cache * feat: config * feat: config * feat: config * feat: v4.36.1 * docs: readme * feat: remove dyn * docs: readme * feat: lock * feat: lock * feat: lock * feat: lock * feat: db pool * feat: db pool * feat: lock * feat: lock * feat: db * feat: db * feat: db * feat: db * feat: db * feat: db * feat: db * feat: db * feat: rand * feat: rand * feat: rand * feat: rand * feat: rand * feat: port * feat: port * feat: port * feat: db * feat: db * feat: db * feat: lock * feat: lock * feat: v4.41.0 * feat: v4.42.0 * Merge remote-tracking branch 'upstream/master' * Merge remote-tracking branch 'upstream/master' * feat: inline * feat: dockerfile --- frameworks/Rust/hyperlane/Cargo.toml | 4 ++-- .../Rust/hyperlane/hyperlane.dockerfile | 4 +++- frameworks/Rust/hyperlane/src/db.rs | 22 +++++++------------ frameworks/Rust/hyperlane/src/lazy.rs | 5 ++--- frameworks/Rust/hyperlane/src/main.rs | 14 ++++-------- frameworks/Rust/hyperlane/src/route.rs | 2 +- frameworks/Rust/hyperlane/src/server.rs | 4 ++-- frameworks/Rust/hyperlane/src/type.rs | 6 ++++- frameworks/Rust/hyperlane/src/utils.rs | 2 -- .../Rust/hyperlane/templates/fortune.hbs | 5 ----- 10 files changed, 27 insertions(+), 41 deletions(-) delete mode 100644 frameworks/Rust/hyperlane/templates/fortune.hbs diff --git a/frameworks/Rust/hyperlane/Cargo.toml b/frameworks/Rust/hyperlane/Cargo.toml index 8b909a01df4..7ca0bbe6f4e 100644 --- a/frameworks/Rust/hyperlane/Cargo.toml +++ b/frameworks/Rust/hyperlane/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "hyperlane_techempower" version = "0.0.1" -edition = "2021" +edition = "2024" authors = ["ltpp-universe "] license = "MIT" description = """Hyperlane is a lightweight and high-performance Rust HTTP server library designed to simplify network service development. It supports HTTP request parsing, response building, and TCP communication, making it ideal for building modern web services. Additionally, it provides support for request and response middleware, WebSocket, and Server-Sent Events (SSE), enabling flexible and efficient real-time communication.""" @@ -18,7 +18,7 @@ exclude = [ ] [dependencies] -hyperlane = "4.36.1" +hyperlane = "4.42.1" rand = "0.9.0" serde = "1.0.219" sqlx = { version = "0.8.3", features = ["runtime-tokio", "postgres"] } diff --git a/frameworks/Rust/hyperlane/hyperlane.dockerfile b/frameworks/Rust/hyperlane/hyperlane.dockerfile index 480553c8c7a..d9bd815fd04 100644 --- a/frameworks/Rust/hyperlane/hyperlane.dockerfile +++ b/frameworks/Rust/hyperlane/hyperlane.dockerfile @@ -1,12 +1,14 @@ FROM rust:1.85 +RUN apt-get update -yqq && apt-get install -yqq cmake g++ binutils lld + ENV POSTGRES_URL=postgres://benchmarkdbuser:benchmarkdbpass@tfb-database:5432/hello_world ADD ./ /hyperlane_techempower WORKDIR /hyperlane_techempower RUN cargo clean -RUN RUSTFLAGS="-C target-cpu=native" cargo build --release +RUN RUSTFLAGS="-C target-cpu=native -C link-arg=-fuse-ld=lld" cargo build --release EXPOSE 8080 diff --git a/frameworks/Rust/hyperlane/src/db.rs b/frameworks/Rust/hyperlane/src/db.rs index d1d51e8ee11..9f4db9f0f5c 100644 --- a/frameworks/Rust/hyperlane/src/db.rs +++ b/frameworks/Rust/hyperlane/src/db.rs @@ -2,20 +2,18 @@ use crate::*; #[inline] pub async fn get_db_connection() -> DbPoolConnection { - if let Some(db_pool) = DB.read().await.clone() { - return db_pool; + if let Some(db_pool) = DB.get() { + return db_pool.clone(); }; let db_pool: DbPoolConnection = connection_db().await; - { - let mut db_pool_lock: RwLockWriteGuard<'_, Option> = DB.write().await; - *db_pool_lock = Some(db_pool.clone()); - } + DB.set(db_pool.clone()) + .expect("Failed to initialize DB_POOL"); db_pool } #[inline] #[cfg(feature = "dev")] -pub async fn create_batabase() { +pub async fn create_database() { let db_pool: DbPoolConnection = get_db_connection().await; let _ = query(&format!("CREATE DATABASE {};", DATABASE_NAME)) .execute(&db_pool) @@ -97,8 +95,7 @@ pub async fn init_cache() { res.push(QueryRow::new(id, random_number)); } } - let mut cache: RwLockWriteGuard<'_, Vec> = CACHE.write().await; - *cache = res; + let _ = CACHE.set(res); } #[inline] @@ -170,13 +167,10 @@ pub async fn get_update_data( #[inline] pub async fn init_db() { - { - let mut db_pool_lock: RwLockWriteGuard<'_, Option> = DB.write().await; - *db_pool_lock = Some(connection_db().await); - } + get_db_connection().await; #[cfg(feature = "dev")] { - create_batabase().await; + create_database().await; create_table().await; insert_records().await; } diff --git a/frameworks/Rust/hyperlane/src/lazy.rs b/frameworks/Rust/hyperlane/src/lazy.rs index 6826b018008..6e95d5019b0 100644 --- a/frameworks/Rust/hyperlane/src/lazy.rs +++ b/frameworks/Rust/hyperlane/src/lazy.rs @@ -1,5 +1,4 @@ use crate::*; -pub static DB: Lazy>> = - Lazy::new(|| Arc::new(RwLock::new(None))); -pub static CACHE: Lazy>> = Lazy::new(|| arc_rwlock(vec![])); +pub static DB: OnceCell = OnceCell::new(); +pub static CACHE: OnceCell> = OnceCell::new(); diff --git a/frameworks/Rust/hyperlane/src/main.rs b/frameworks/Rust/hyperlane/src/main.rs index ef4a7838faa..72253debec0 100644 --- a/frameworks/Rust/hyperlane/src/main.rs +++ b/frameworks/Rust/hyperlane/src/main.rs @@ -10,16 +10,9 @@ pub(crate) mod utils; pub(crate) use constant::*; pub(crate) use db::*; -pub(crate) use hyperlane::{ - once_cell::sync::Lazy, - serde::*, - serde_json::json, - tokio::sync::{RwLock, RwLockReadGuard, RwLockWriteGuard}, - *, -}; +pub(crate) use hyperlane::{once_cell::sync::OnceCell, serde::*, serde_json::json, *}; pub(crate) use lazy::*; -pub(crate) use r#type::*; -pub(crate) use rand::{rngs::SmallRng, Rng, SeedableRng}; +pub(crate) use rand::{Rng, SeedableRng, rng, rngs::SmallRng}; pub(crate) use request_middleware::*; pub(crate) use response_middleware::*; pub(crate) use route::*; @@ -28,7 +21,8 @@ pub(crate) use sqlx::{ postgres::{PgPoolOptions, PgRow}, *, }; -pub(crate) use std::{fmt, sync::Arc}; +pub(crate) use std::fmt; +pub(crate) use r#type::*; pub(crate) use utils::*; #[tokio::main] diff --git a/frameworks/Rust/hyperlane/src/route.rs b/frameworks/Rust/hyperlane/src/route.rs index e52db693195..c3c7cbcb855 100644 --- a/frameworks/Rust/hyperlane/src/route.rs +++ b/frameworks/Rust/hyperlane/src/route.rs @@ -97,7 +97,7 @@ pub async fn cached_queries(controller_data: ControllerData) { .min(ROW_LIMIT as Queries) .max(1); let mut res: Vec = Vec::with_capacity(count as usize); - let cache: RwLockReadGuard<'_, Vec> = CACHE.read().await; + let cache: Vec = CACHE.get().cloned().unwrap_or_default(); for i in 0..count { res.push(cache[i as usize].clone()); } diff --git a/frameworks/Rust/hyperlane/src/server.rs b/frameworks/Rust/hyperlane/src/server.rs index 91dc1aeea08..568fb066446 100644 --- a/frameworks/Rust/hyperlane/src/server.rs +++ b/frameworks/Rust/hyperlane/src/server.rs @@ -9,13 +9,13 @@ pub async fn run_server() { server.log_interval_millis(1_000_000_000).await; server.disable_inner_log().await; server.disable_inner_print().await; - server.route("/json", json).await; server.route("/plaintext", plaintext).await; + server.route("/json", json).await; + server.route("/cached-quer", cached_queries).await; server.route("/db", db).await; server.route("/query", queries).await; server.route("/fortunes", fortunes).await; server.route("/upda", updates).await; - server.route("/cached-quer", cached_queries).await; server.request_middleware(request).await; server.response_middleware(response).await; server.listen().await; diff --git a/frameworks/Rust/hyperlane/src/type.rs b/frameworks/Rust/hyperlane/src/type.rs index 3fb320ba049..9ec11ff4342 100644 --- a/frameworks/Rust/hyperlane/src/type.rs +++ b/frameworks/Rust/hyperlane/src/type.rs @@ -44,9 +44,13 @@ impl FortunesTemplate { } impl fmt::Display for FortunesTemplate { + #[inline] fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let fortunes: &Vec = &self.0; - let _ = write!(f, "Fortunes"); + let _ = write!( + f, + "Fortunes
idmessage
" + ); for tem in fortunes.iter() { let row: String = format!( "", diff --git a/frameworks/Rust/hyperlane/src/utils.rs b/frameworks/Rust/hyperlane/src/utils.rs index 9552fe79074..16e8cdd8839 100644 --- a/frameworks/Rust/hyperlane/src/utils.rs +++ b/frameworks/Rust/hyperlane/src/utils.rs @@ -1,5 +1,3 @@ -use rand::rng; - use crate::*; #[inline] diff --git a/frameworks/Rust/hyperlane/templates/fortune.hbs b/frameworks/Rust/hyperlane/templates/fortune.hbs deleted file mode 100644 index b9e25a52a8e..00000000000 --- a/frameworks/Rust/hyperlane/templates/fortune.hbs +++ /dev/null @@ -1,5 +0,0 @@ -Fortunes
idmessage
{}{}
- {{~# each fortunes ~}} - - {{~/each ~}} -
idmessage
{{id}}{{message}}
From 927b9e826b73ab35bdf38612786bd5c11debc0a3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 21 Mar 2025 17:05:31 +0000 Subject: [PATCH 33/39] Bump next from 15.1.3 to 15.2.3 in /frameworks/TypeScript/nextjs Bumps [next](https://github.com/vercel/next.js) from 15.1.3 to 15.2.3. - [Release notes](https://github.com/vercel/next.js/releases) - [Changelog](https://github.com/vercel/next.js/blob/canary/release.js) - [Commits](https://github.com/vercel/next.js/compare/v15.1.3...v15.2.3) --- updated-dependencies: - dependency-name: next dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- .../TypeScript/nextjs/package-lock.json | 80 +++++++++---------- frameworks/TypeScript/nextjs/package.json | 2 +- 2 files changed, 41 insertions(+), 41 deletions(-) diff --git a/frameworks/TypeScript/nextjs/package-lock.json b/frameworks/TypeScript/nextjs/package-lock.json index 66e3d67f8a2..40fc15b10e4 100644 --- a/frameworks/TypeScript/nextjs/package-lock.json +++ b/frameworks/TypeScript/nextjs/package-lock.json @@ -9,7 +9,7 @@ "version": "0.1.0", "dependencies": { "kysely": "^0.27.5", - "next": "^15.1.3", + "next": "^15.2.3", "pg": "^8.13.1", "react": "^19.0.0", "react-dom": "^19.0.0" @@ -394,15 +394,15 @@ } }, "node_modules/@next/env": { - "version": "15.1.3", - "resolved": "https://registry.npmjs.org/@next/env/-/env-15.1.3.tgz", - "integrity": "sha512-Q1tXwQCGWyA3ehMph3VO+E6xFPHDKdHFYosadt0F78EObYxPio0S09H9UGYznDe6Wc8eLKLG89GqcFJJDiK5xw==", + "version": "15.2.3", + "resolved": "https://registry.npmjs.org/@next/env/-/env-15.2.3.tgz", + "integrity": "sha512-a26KnbW9DFEUsSxAxKBORR/uD9THoYoKbkpFywMN/AFvboTt94b8+g/07T8J6ACsdLag8/PDU60ov4rPxRAixw==", "license": "MIT" }, "node_modules/@next/swc-darwin-arm64": { - "version": "15.1.3", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-15.1.3.tgz", - "integrity": "sha512-aZtmIh8jU89DZahXQt1La0f2EMPt/i7W+rG1sLtYJERsP7GRnNFghsciFpQcKHcGh4dUiyTB5C1X3Dde/Gw8gg==", + "version": "15.2.3", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-15.2.3.tgz", + "integrity": "sha512-uaBhA8aLbXLqwjnsHSkxs353WrRgQgiFjduDpc7YXEU0B54IKx3vU+cxQlYwPCyC8uYEEX7THhtQQsfHnvv8dw==", "cpu": [ "arm64" ], @@ -416,9 +416,9 @@ } }, "node_modules/@next/swc-darwin-x64": { - "version": "15.1.3", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-15.1.3.tgz", - "integrity": "sha512-aw8901rjkVBK5mbq5oV32IqkJg+CQa6aULNlN8zyCWSsePzEG3kpDkAFkkTOh3eJ0p95KbkLyWBzslQKamXsLA==", + "version": "15.2.3", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-15.2.3.tgz", + "integrity": "sha512-pVwKvJ4Zk7h+4hwhqOUuMx7Ib02u3gDX3HXPKIShBi9JlYllI0nU6TWLbPT94dt7FSi6mSBhfc2JrHViwqbOdw==", "cpu": [ "x64" ], @@ -432,9 +432,9 @@ } }, "node_modules/@next/swc-linux-arm64-gnu": { - "version": "15.1.3", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-15.1.3.tgz", - "integrity": "sha512-YbdaYjyHa4fPK4GR4k2XgXV0p8vbU1SZh7vv6El4bl9N+ZSiMfbmqCuCuNU1Z4ebJMumafaz6UCC2zaJCsdzjw==", + "version": "15.2.3", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-15.2.3.tgz", + "integrity": "sha512-50ibWdn2RuFFkOEUmo9NCcQbbV9ViQOrUfG48zHBCONciHjaUKtHcYFiCwBVuzD08fzvzkWuuZkd4AqbvKO7UQ==", "cpu": [ "arm64" ], @@ -448,9 +448,9 @@ } }, "node_modules/@next/swc-linux-arm64-musl": { - "version": "15.1.3", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-15.1.3.tgz", - "integrity": "sha512-qgH/aRj2xcr4BouwKG3XdqNu33SDadqbkqB6KaZZkozar857upxKakbRllpqZgWl/NDeSCBYPmUAZPBHZpbA0w==", + "version": "15.2.3", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-15.2.3.tgz", + "integrity": "sha512-2gAPA7P652D3HzR4cLyAuVYwYqjG0mt/3pHSWTCyKZq/N/dJcUAEoNQMyUmwTZWCJRKofB+JPuDVP2aD8w2J6Q==", "cpu": [ "arm64" ], @@ -464,9 +464,9 @@ } }, "node_modules/@next/swc-linux-x64-gnu": { - "version": "15.1.3", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-15.1.3.tgz", - "integrity": "sha512-uzafnTFwZCPN499fNVnS2xFME8WLC9y7PLRs/yqz5lz1X/ySoxfaK2Hbz74zYUdEg+iDZPd8KlsWaw9HKkLEVw==", + "version": "15.2.3", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-15.2.3.tgz", + "integrity": "sha512-ODSKvrdMgAJOVU4qElflYy1KSZRM3M45JVbeZu42TINCMG3anp7YCBn80RkISV6bhzKwcUqLBAmOiWkaGtBA9w==", "cpu": [ "x64" ], @@ -480,9 +480,9 @@ } }, "node_modules/@next/swc-linux-x64-musl": { - "version": "15.1.3", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-15.1.3.tgz", - "integrity": "sha512-el6GUFi4SiDYnMTTlJJFMU+GHvw0UIFnffP1qhurrN1qJV3BqaSRUjkDUgVV44T6zpw1Lc6u+yn0puDKHs+Sbw==", + "version": "15.2.3", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-15.2.3.tgz", + "integrity": "sha512-ZR9kLwCWrlYxwEoytqPi1jhPd1TlsSJWAc+H/CJHmHkf2nD92MQpSRIURR1iNgA/kuFSdxB8xIPt4p/T78kwsg==", "cpu": [ "x64" ], @@ -496,9 +496,9 @@ } }, "node_modules/@next/swc-win32-arm64-msvc": { - "version": "15.1.3", - "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-15.1.3.tgz", - "integrity": "sha512-6RxKjvnvVMM89giYGI1qye9ODsBQpHSHVo8vqA8xGhmRPZHDQUE4jcDbhBwK0GnFMqBnu+XMg3nYukNkmLOLWw==", + "version": "15.2.3", + "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-15.2.3.tgz", + "integrity": "sha512-+G2FrDcfm2YDbhDiObDU/qPriWeiz/9cRR0yMWJeTLGGX6/x8oryO3tt7HhodA1vZ8r2ddJPCjtLcpaVl7TE2Q==", "cpu": [ "arm64" ], @@ -512,9 +512,9 @@ } }, "node_modules/@next/swc-win32-x64-msvc": { - "version": "15.1.3", - "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-15.1.3.tgz", - "integrity": "sha512-VId/f5blObG7IodwC5Grf+aYP0O8Saz1/aeU3YcWqNdIUAmFQY3VEPKPaIzfv32F/clvanOb2K2BR5DtDs6XyQ==", + "version": "15.2.3", + "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-15.2.3.tgz", + "integrity": "sha512-gHYS9tc+G2W0ZC8rBL+H6RdtXIyk40uLiaos0yj5US85FNhbFEndMA2nW3z47nzOWiSvXTZ5kBClc3rD0zJg0w==", "cpu": [ "x64" ], @@ -780,12 +780,12 @@ } }, "node_modules/next": { - "version": "15.1.3", - "resolved": "https://registry.npmjs.org/next/-/next-15.1.3.tgz", - "integrity": "sha512-5igmb8N8AEhWDYzogcJvtcRDU6n4cMGtBklxKD4biYv4LXN8+awc/bbQ2IM2NQHdVPgJ6XumYXfo3hBtErg1DA==", + "version": "15.2.3", + "resolved": "https://registry.npmjs.org/next/-/next-15.2.3.tgz", + "integrity": "sha512-x6eDkZxk2rPpu46E1ZVUWIBhYCLszmUY6fvHBFcbzJ9dD+qRX6vcHusaqqDlnY+VngKzKbAiG2iRCkPbmi8f7w==", "license": "MIT", "dependencies": { - "@next/env": "15.1.3", + "@next/env": "15.2.3", "@swc/counter": "0.1.3", "@swc/helpers": "0.5.15", "busboy": "1.6.0", @@ -800,14 +800,14 @@ "node": "^18.18.0 || ^19.8.0 || >= 20.0.0" }, "optionalDependencies": { - "@next/swc-darwin-arm64": "15.1.3", - "@next/swc-darwin-x64": "15.1.3", - "@next/swc-linux-arm64-gnu": "15.1.3", - "@next/swc-linux-arm64-musl": "15.1.3", - "@next/swc-linux-x64-gnu": "15.1.3", - "@next/swc-linux-x64-musl": "15.1.3", - "@next/swc-win32-arm64-msvc": "15.1.3", - "@next/swc-win32-x64-msvc": "15.1.3", + "@next/swc-darwin-arm64": "15.2.3", + "@next/swc-darwin-x64": "15.2.3", + "@next/swc-linux-arm64-gnu": "15.2.3", + "@next/swc-linux-arm64-musl": "15.2.3", + "@next/swc-linux-x64-gnu": "15.2.3", + "@next/swc-linux-x64-musl": "15.2.3", + "@next/swc-win32-arm64-msvc": "15.2.3", + "@next/swc-win32-x64-msvc": "15.2.3", "sharp": "^0.33.5" }, "peerDependencies": { diff --git a/frameworks/TypeScript/nextjs/package.json b/frameworks/TypeScript/nextjs/package.json index bc87525a493..4b71a8daca5 100644 --- a/frameworks/TypeScript/nextjs/package.json +++ b/frameworks/TypeScript/nextjs/package.json @@ -10,7 +10,7 @@ }, "dependencies": { "kysely": "^0.27.5", - "next": "^15.1.3", + "next": "^15.2.3", "pg": "^8.13.1", "react": "^19.0.0", "react-dom": "^19.0.0" From 957dec95b8741aa1b2696d7a6ba988a73005e54f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 21 Mar 2025 22:15:18 +0000 Subject: [PATCH 34/39] Bump github.com/golang-jwt/jwt/v5 in /frameworks/Go/goravel/src/fiber Bumps [github.com/golang-jwt/jwt/v5](https://github.com/golang-jwt/jwt) from 5.2.1 to 5.2.2. - [Release notes](https://github.com/golang-jwt/jwt/releases) - [Changelog](https://github.com/golang-jwt/jwt/blob/main/VERSION_HISTORY.md) - [Commits](https://github.com/golang-jwt/jwt/compare/v5.2.1...v5.2.2) --- updated-dependencies: - dependency-name: github.com/golang-jwt/jwt/v5 dependency-type: indirect ... Signed-off-by: dependabot[bot] --- frameworks/Go/goravel/src/fiber/go.mod | 2 +- frameworks/Go/goravel/src/fiber/go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/frameworks/Go/goravel/src/fiber/go.mod b/frameworks/Go/goravel/src/fiber/go.mod index 87ba6260420..8c5b49edc32 100644 --- a/frameworks/Go/goravel/src/fiber/go.mod +++ b/frameworks/Go/goravel/src/fiber/go.mod @@ -66,7 +66,7 @@ require ( github.com/gofiber/template/html/v2 v2.1.1 // indirect github.com/gofiber/utils v1.1.0 // indirect github.com/golang-jwt/jwt/v4 v4.5.1 // indirect - github.com/golang-jwt/jwt/v5 v5.2.1 // indirect + github.com/golang-jwt/jwt/v5 v5.2.2 // indirect github.com/golang-migrate/migrate/v4 v4.17.1 // indirect github.com/golang-module/carbon/v2 v2.3.12 // indirect github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 // indirect diff --git a/frameworks/Go/goravel/src/fiber/go.sum b/frameworks/Go/goravel/src/fiber/go.sum index 2106df44b89..a22d712901e 100644 --- a/frameworks/Go/goravel/src/fiber/go.sum +++ b/frameworks/Go/goravel/src/fiber/go.sum @@ -289,8 +289,8 @@ github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w github.com/golang-jwt/jwt/v4 v4.5.1 h1:JdqV9zKUdtaa9gdPlywC3aeoEsR681PlKC+4F5gQgeo= github.com/golang-jwt/jwt/v4 v4.5.1/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= github.com/golang-jwt/jwt/v5 v5.0.0/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= -github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= -github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= +github.com/golang-jwt/jwt/v5 v5.2.2 h1:Rl4B7itRWVtYIHFrSNd7vhTiz9UpLdi6gZhZ3wEeDy8= +github.com/golang-jwt/jwt/v5 v5.2.2/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= github.com/golang-migrate/migrate/v4 v4.17.1 h1:4zQ6iqL6t6AiItphxJctQb3cFqWiSpMnX7wLTPnnYO4= github.com/golang-migrate/migrate/v4 v4.17.1/go.mod h1:m8hinFyWBn0SA4QKHuKh175Pm9wjmxj3S2Mia7dbXzM= github.com/golang-module/carbon/v2 v2.3.12 h1:VC1DwN1kBwJkh5MjXmTFryjs5g4CWyoM8HAHffZPX/k= From 7321073d9e823e6fda1b6cb4a72ad4f8ae2b880d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 21 Mar 2025 22:30:08 +0000 Subject: [PATCH 35/39] Bump github.com/golang-jwt/jwt/v4 in /frameworks/Go/goravel/src/gin Bumps [github.com/golang-jwt/jwt/v4](https://github.com/golang-jwt/jwt) from 4.5.1 to 4.5.2. - [Release notes](https://github.com/golang-jwt/jwt/releases) - [Changelog](https://github.com/golang-jwt/jwt/blob/main/VERSION_HISTORY.md) - [Commits](https://github.com/golang-jwt/jwt/compare/v4.5.1...v4.5.2) --- updated-dependencies: - dependency-name: github.com/golang-jwt/jwt/v4 dependency-type: indirect ... Signed-off-by: dependabot[bot] --- frameworks/Go/goravel/src/gin/go.mod | 2 +- frameworks/Go/goravel/src/gin/go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/frameworks/Go/goravel/src/gin/go.mod b/frameworks/Go/goravel/src/gin/go.mod index 8547a95c5d3..1e61f0b5682 100644 --- a/frameworks/Go/goravel/src/gin/go.mod +++ b/frameworks/Go/goravel/src/gin/go.mod @@ -65,7 +65,7 @@ require ( github.com/go-sql-driver/mysql v1.8.1 // indirect github.com/go-stack/stack v1.8.0 // indirect github.com/goccy/go-json v0.10.2 // indirect - github.com/golang-jwt/jwt/v4 v4.5.1 // indirect + github.com/golang-jwt/jwt/v4 v4.5.2 // indirect github.com/golang-jwt/jwt/v5 v5.2.1 // indirect github.com/golang-migrate/migrate/v4 v4.17.1 // indirect github.com/golang-module/carbon/v2 v2.3.12 // indirect diff --git a/frameworks/Go/goravel/src/gin/go.sum b/frameworks/Go/goravel/src/gin/go.sum index 8318d8ee4d8..2d7f6ccefad 100644 --- a/frameworks/Go/goravel/src/gin/go.sum +++ b/frameworks/Go/goravel/src/gin/go.sum @@ -288,8 +288,8 @@ github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69 github.com/golang-jwt/jwt/v4 v4.0.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= github.com/golang-jwt/jwt/v4 v4.4.3/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= -github.com/golang-jwt/jwt/v4 v4.5.1 h1:JdqV9zKUdtaa9gdPlywC3aeoEsR681PlKC+4F5gQgeo= -github.com/golang-jwt/jwt/v4 v4.5.1/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= +github.com/golang-jwt/jwt/v4 v4.5.2 h1:YtQM7lnr8iZ+j5q71MGKkNw9Mn7AjHM68uc9g5fXeUI= +github.com/golang-jwt/jwt/v4 v4.5.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= github.com/golang-jwt/jwt/v5 v5.0.0/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= github.com/golang-jwt/jwt/v5 v5.2.1 h1:OuVbFODueb089Lh128TAcimifWaLhJwVflnrgM17wHk= github.com/golang-jwt/jwt/v5 v5.2.1/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= From 6d42c392e69db1b571512900faa0d9a8ca36e6f4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 21 Mar 2025 23:48:29 +0000 Subject: [PATCH 36/39] Bump nokogiri from 1.18.3 to 1.18.4 in /frameworks/Ruby/rails Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.18.3 to 1.18.4. - [Release notes](https://github.com/sparklemotion/nokogiri/releases) - [Changelog](https://github.com/sparklemotion/nokogiri/blob/main/CHANGELOG.md) - [Commits](https://github.com/sparklemotion/nokogiri/compare/v1.18.3...v1.18.4) --- updated-dependencies: - dependency-name: nokogiri dependency-type: indirect ... Signed-off-by: dependabot[bot] --- frameworks/Ruby/rails/Gemfile.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frameworks/Ruby/rails/Gemfile.lock b/frameworks/Ruby/rails/Gemfile.lock index 2f8f40f851a..98ba2e7c84e 100644 --- a/frameworks/Ruby/rails/Gemfile.lock +++ b/frameworks/Ruby/rails/Gemfile.lock @@ -175,12 +175,12 @@ GEM net-smtp (0.5.1) net-protocol nio4r (2.7.4) - nokogiri (1.18.3) + nokogiri (1.18.4) mini_portile2 (~> 2.8.2) racc (~> 1.4) - nokogiri (1.18.3-x86_64-darwin) + nokogiri (1.18.4-x86_64-darwin) racc (~> 1.4) - nokogiri (1.18.3-x86_64-linux-gnu) + nokogiri (1.18.4-x86_64-linux-gnu) racc (~> 1.4) openssl (3.3.0) pg (1.5.9) From d8358add5406f3544af967d9bc81ce987cf23430 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 22 Mar 2025 00:06:59 +0000 Subject: [PATCH 37/39] Bump gunicorn from 20.1.0 to 23.0.0 in /frameworks/Python/falcon Bumps [gunicorn](https://github.com/benoitc/gunicorn) from 20.1.0 to 23.0.0. - [Release notes](https://github.com/benoitc/gunicorn/releases) - [Commits](https://github.com/benoitc/gunicorn/compare/20.1.0...23.0.0) --- updated-dependencies: - dependency-name: gunicorn dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- frameworks/Python/falcon/requirements-meinheld.txt | 2 +- frameworks/Python/falcon/requirements-pypy.txt | 2 +- frameworks/Python/falcon/requirements-uvicorn.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/frameworks/Python/falcon/requirements-meinheld.txt b/frameworks/Python/falcon/requirements-meinheld.txt index ab4da943513..c816f95c997 100644 --- a/frameworks/Python/falcon/requirements-meinheld.txt +++ b/frameworks/Python/falcon/requirements-meinheld.txt @@ -1,2 +1,2 @@ -gunicorn==20.1.0 +gunicorn==23.0.0 meinheld==1.0.2 diff --git a/frameworks/Python/falcon/requirements-pypy.txt b/frameworks/Python/falcon/requirements-pypy.txt index 9d41f264a67..4afe40e70ce 100644 --- a/frameworks/Python/falcon/requirements-pypy.txt +++ b/frameworks/Python/falcon/requirements-pypy.txt @@ -1 +1 @@ -gunicorn==20.1.0 +gunicorn==23.0.0 diff --git a/frameworks/Python/falcon/requirements-uvicorn.txt b/frameworks/Python/falcon/requirements-uvicorn.txt index 23016ffc9d7..fcbed985e7e 100644 --- a/frameworks/Python/falcon/requirements-uvicorn.txt +++ b/frameworks/Python/falcon/requirements-uvicorn.txt @@ -1,4 +1,4 @@ -gunicorn==20.1.0 +gunicorn==23.0.0 httptools==0.5.0 uvloop==0.17.0 uvicorn==0.21.1 From dbc80f479747cdc7f357c1b525e7574171cfd915 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 22 Mar 2025 00:24:34 +0000 Subject: [PATCH 38/39] Bump gunicorn from 22.0.0 to 23.0.0 in /frameworks/Python/api_hour Bumps [gunicorn](https://github.com/benoitc/gunicorn) from 22.0.0 to 23.0.0. - [Release notes](https://github.com/benoitc/gunicorn/releases) - [Commits](https://github.com/benoitc/gunicorn/compare/22.0.0...23.0.0) --- updated-dependencies: - dependency-name: gunicorn dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- frameworks/Python/api_hour/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frameworks/Python/api_hour/requirements.txt b/frameworks/Python/api_hour/requirements.txt index 9045239a633..5db05703f22 100644 --- a/frameworks/Python/api_hour/requirements.txt +++ b/frameworks/Python/api_hour/requirements.txt @@ -4,7 +4,7 @@ aiopg==0.7.0 -e git+https://github.com/Eyepea/API-Hour.git@577abbdcbb8cc2810dad46e260b338b15db4d0e3#egg=api_hour-master asyncio-redis==0.13.4 chardet==2.3.0 -gunicorn==22.0.0 +gunicorn==23.0.0 hiredis==0.2.0 Jinja2==3.1.4 MarkupSafe==0.23 From 3492fa2b04d3a5b7cca85a16cf635321ae475deb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sat, 22 Mar 2025 01:49:33 +0000 Subject: [PATCH 39/39] Bump gunicorn from 20.1.0 to 23.0.0 in /frameworks/Python/starlette Bumps [gunicorn](https://github.com/benoitc/gunicorn) from 20.1.0 to 23.0.0. - [Release notes](https://github.com/benoitc/gunicorn/releases) - [Commits](https://github.com/benoitc/gunicorn/compare/20.1.0...23.0.0) --- updated-dependencies: - dependency-name: gunicorn dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- frameworks/Python/starlette/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frameworks/Python/starlette/requirements.txt b/frameworks/Python/starlette/requirements.txt index 47b27a87e9a..b94ce4d5784 100644 --- a/frameworks/Python/starlette/requirements.txt +++ b/frameworks/Python/starlette/requirements.txt @@ -1,5 +1,5 @@ asyncpg==0.26.0 -gunicorn==20.1.0 +gunicorn==23.0.0 httptools==0.5.0 idna==3.7 Jinja2==3.1.4