From b959963bff739da0818a8869e1f1bb8d689cf5b8 Mon Sep 17 00:00:00 2001 From: Petrik de Heus Date: Mon, 3 Jun 2024 22:27:40 +0200 Subject: [PATCH 01/45] [crystal/h2o.cr] Remove as no longer maintained (#9083) The h2o.cr bindings haven't been updated in 6 years and don't work with Crystal v1. https://github.com/S-YOU/h2o.cr These are currently failing in the test runs, as well. --- frameworks/Crystal/h2o.cr/README.md | 7 -- .../Crystal/h2o.cr/benchmark_config.json | 26 ---- frameworks/Crystal/h2o.cr/config.toml | 15 --- frameworks/Crystal/h2o.cr/h2o.cr.dockerfile | 24 ---- frameworks/Crystal/h2o.cr/h2o_evloop_hello.cr | 114 ------------------ frameworks/Crystal/h2o.cr/run.sh | 7 -- frameworks/Crystal/h2o.cr/shard.yml | 15 --- 7 files changed, 208 deletions(-) delete mode 100644 frameworks/Crystal/h2o.cr/README.md delete mode 100644 frameworks/Crystal/h2o.cr/benchmark_config.json delete mode 100644 frameworks/Crystal/h2o.cr/config.toml delete mode 100644 frameworks/Crystal/h2o.cr/h2o.cr.dockerfile delete mode 100644 frameworks/Crystal/h2o.cr/h2o_evloop_hello.cr delete mode 100644 frameworks/Crystal/h2o.cr/run.sh delete mode 100755 frameworks/Crystal/h2o.cr/shard.yml diff --git a/frameworks/Crystal/h2o.cr/README.md b/frameworks/Crystal/h2o.cr/README.md deleted file mode 100644 index 72d68953ed5..00000000000 --- a/frameworks/Crystal/h2o.cr/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# h2o.cr - -Crystal bindings to h2o - -### notes - -h2o.cr currently only support plaintext and json requests diff --git a/frameworks/Crystal/h2o.cr/benchmark_config.json b/frameworks/Crystal/h2o.cr/benchmark_config.json deleted file mode 100644 index f2446c191b8..00000000000 --- a/frameworks/Crystal/h2o.cr/benchmark_config.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "framework": "h2o.cr", - "tests": [ - { - "default": { - "json_url": "/json", - "plaintext_url": "/plaintext", - "port": 7890, - "approach": "Realistic", - "classification": "Micro", - "database": "None", - "framework": "h2o.cr", - "language": "Crystal", - "flavor": "None", - "orm": "Raw", - "platform": "None", - "webserver": "h2o", - "os": "Linux", - "database_os": "Linux", - "display_name": "crystal-h2o", - "notes": "", - "versus": "None" - } - } - ] -} diff --git a/frameworks/Crystal/h2o.cr/config.toml b/frameworks/Crystal/h2o.cr/config.toml deleted file mode 100644 index 2905fb412bb..00000000000 --- a/frameworks/Crystal/h2o.cr/config.toml +++ /dev/null @@ -1,15 +0,0 @@ -[framework] -name = "h2o.cr" - -[main] -urls.plaintext = "/plaintext" -urls.json = "/json" -approach = "Realistic" -classification = "Micro" -database = "None" -database_os = "Linux" -os = "Linux" -orm = "Raw" -platform = "None" -webserver = "h2o" -versus = "None" diff --git a/frameworks/Crystal/h2o.cr/h2o.cr.dockerfile b/frameworks/Crystal/h2o.cr/h2o.cr.dockerfile deleted file mode 100644 index 690ca6fe783..00000000000 --- a/frameworks/Crystal/h2o.cr/h2o.cr.dockerfile +++ /dev/null @@ -1,24 +0,0 @@ -FROM debian:sid - -RUN apt-get update \ - && apt-get install -yqq libh2o-evloop-dev libwslay-dev libyaml-0-2 libevent-dev libpcre3-dev \ - gcc wget git libssl-dev libuv1-dev ca-certificates --no-install-recommends - -RUN wget -q https://github.com/crystal-lang/crystal/releases/download/0.26.1/crystal-0.26.1-1-linux-x86_64.tar.gz \ - && tar --strip-components=1 -xzf crystal-0.26.1-1-linux-x86_64.tar.gz -C /usr/ \ - && rm -f *.tar.gz - -WORKDIR /crystal - -ENV GC_MARKERS 1 - -COPY ./ ./ - -RUN shards install -RUN gcc -shared -O3 lib/h2o/src/ext/h2o.c -I/usr/include -fPIC -o h2o.o -ENV CRYSTAL_PATH=lib:/usr/share/crystal/src -RUN crystal build --prelude=empty --no-debug --release -Dgc_none -Dfiber_none -Dexcept_none -Dhash_none -Dtime_none -Dregex_none -Dextreme h2o_evloop_hello.cr --link-flags="-Wl,-s $PWD/h2o.o -DH2O_USE_LIBUV=0" -o server.out - -EXPOSE 7890 - -CMD sh run.sh diff --git a/frameworks/Crystal/h2o.cr/h2o_evloop_hello.cr b/frameworks/Crystal/h2o.cr/h2o_evloop_hello.cr deleted file mode 100644 index 558a1ec0ac3..00000000000 --- a/frameworks/Crystal/h2o.cr/h2o_evloop_hello.cr +++ /dev/null @@ -1,114 +0,0 @@ -require "reset/prelude" -require "reset/patches" -require "reset/json" -require "h2o/h2o_evloop" - -class H2oHello < H2o - @config = LibH2o::H2oGlobalconfT.new - @ctx = LibH2o::H2oContextT.new - @accept_ctx = LibH2o::H2oAcceptCtxT.new - @loop : LibH2o::H2oLoopT* - - macro hello - Handler.new do |handler, req| - generator = uninitialized LibH2o::H2oGeneratorT[2] - body = h2o_iovec_init("Hello, World!") - req.value.res.status = 200 - req.value.res.reason = "OK" - req.value.res.content_length = body.len - - # require h2o.c extension - h2o_add_header(req, H2O_TOKEN_CONTENT_TYPE, "text/plain") - h2o_start_response(req, generator) - h2o_send(req, pointerof(body), 1, LibH2o::H2oSendState::H2OSendStateFinal) - 0 - end - end - - macro json - Handler.new do |handler, req| - generator = uninitialized LibH2o::H2oGeneratorT[2] - alloc = uninitialized UInt8[32] - buf = StackBuffer.new(alloc.to_unsafe) - - len = {message: "Hello, World!"}.to_json(buf) - body = LibH2o::H2oIovecT.new(base: buf, len: len) - - req.value.res.status = 200 - req.value.res.reason = "OK" - req.value.res.content_length = body.len - - h2o_add_header(req, H2O_TOKEN_CONTENT_TYPE, "application/json") - h2o_start_response(req, generator) - h2o_send(req, pointerof(body), 1, LibH2o::H2oSendState::H2OSendStateFinal) - 0 - end - end - - def on_accept(listener : LibH2o::H2oSocketT*, err : LibC::Char*) : Void - return if err - return unless s = h2o_evloop_socket_accept(listener) - h2o_accept(pointerof(@accept_ctx), s) - end - - def create_listener : Int32 - addr = uninitialized LibC::SockaddrIn - - pointerof(addr).clear - addr.sin_family = LibC::AF_INET - addr.sin_addr.s_addr = 0 # 0x100007f # b32(0x7f000001) - addr.sin_port = 0xd21e # b16(7890) - - option = 1 - if (fd = socket(LibC::AF_INET, LibC::SOCK_STREAM | LibC::O_NONBLOCK | LibC::O_CLOEXEC, 0)) == -1 || - setsockopt(fd, LibC::SOL_SOCKET, LibC::SO_REUSEADDR, pointerof(option), 4) != 0 || - setsockopt(fd, LibC::SOL_SOCKET, LibC::SO_REUSEPORT, pointerof(option), 4) != 0 || - setsockopt(fd, LibC::IPPROTO_TCP, LibC::TCP_QUICKACK, pointerof(option), 4) != 0 || - ((option = H2O_DEFAULT_HANDSHAKE_TIMEOUT_IN_SECS) && - setsockopt(fd, LibC::IPPROTO_TCP, LibC::TCP_DEFER_ACCEPT, pointerof(option), 4) != 0) || - ((option = DEFAULT_TCP_FASTOPEN_QUEUE_LEN) && - setsockopt(fd, LibC::IPPROTO_TCP, LibC::TCP_FASTOPEN, pointerof(option), 4) != 0) || - bind(fd, pointerof(addr).as(LibC::Sockaddr*), sizeof(LibC::SockaddrIn)) != 0 || - listen(fd, LibC::SOMAXCONN) != 0 - return -1 - end - - sock = h2o_evloop_socket_create(@ctx.loop, fd, H2O_SOCKET_FLAG_DONT_READ) - h2o_socket_read_start(sock, LibH2o::H2oSocketCb.new { |listener, err| - {{@type}}.instance.on_accept(listener, err) - }) - 0 - end - - def register_handler(hostconf : LibH2o::H2oHostconfT*, path : String, on_req : Handler) : Void - pathconf = h2o_config_register_path(hostconf, path, 0) - handler = h2o_create_handler(pathconf, sizeof(LibH2o::H2oHandlerT)) - handler.value.on_req = on_req - end - - def initialize - @loop = h2o_evloop_create() - end - - def run : Void - h2o_config_init(pointerof(@config)) - @config.server_name = h2o_iovec_init("h2o") - - hostconf = h2o_config_register_host(pointerof(@config), h2o_iovec_init("default"), 65535) - register_handler(hostconf, "/plaintext", hello) - register_handler(hostconf, "/json", json) - - h2o_context_init(pointerof(@ctx), @loop, pointerof(@config)) - - @accept_ctx.ctx = pointerof(@ctx) - @accept_ctx.hosts = @config.hosts - - if create_listener != 0 - return 1 - end - - while h2o_evloop_run(@ctx.loop, Int32::MAX) == 0; end - end -end - -H2oHello.run diff --git a/frameworks/Crystal/h2o.cr/run.sh b/frameworks/Crystal/h2o.cr/run.sh deleted file mode 100644 index 44f9c8a4db9..00000000000 --- a/frameworks/Crystal/h2o.cr/run.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -for i in $(seq 1 $(nproc --all)); do - ./server.out & -done - -wait diff --git a/frameworks/Crystal/h2o.cr/shard.yml b/frameworks/Crystal/h2o.cr/shard.yml deleted file mode 100755 index e203604b6cd..00000000000 --- a/frameworks/Crystal/h2o.cr/shard.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: crystal-h2o -version: 0.0.1 - -license: MIT - -crystal: 0.26.1 - -dependencies: - h2o: - github: s-you/h2o.cr - uv: - github: s-you/uv.cr - reset: - github: s-you/reset.cr - branch: h2o From 368c1f93b94d1d0027b1ed7fd0807cd0d7365caf Mon Sep 17 00:00:00 2001 From: Anton Kirilov Date: Mon, 3 Jun 2024 21:28:36 +0100 Subject: [PATCH 02/45] Another PostgreSQL configuration file clean-up (#9078) This change makes it easier to check how exactly we deviate from the default settings. --- .../databases/postgres/postgres.dockerfile | 6 +- toolset/databases/postgres/postgresql.conf | 145 +++--------------- 2 files changed, 20 insertions(+), 131 deletions(-) diff --git a/toolset/databases/postgres/postgres.dockerfile b/toolset/databases/postgres/postgres.dockerfile index 4a23b39ee70..757d3ba79e8 100644 --- a/toolset/databases/postgres/postgres.dockerfile +++ b/toolset/databases/postgres/postgres.dockerfile @@ -7,8 +7,6 @@ ENV PGDATA=/ssd/postgresql \ POSTGRES_PASSWORD=benchmarkdbpass \ POSTGRES_USER=benchmarkdbuser -COPY postgresql.conf /tmp/ - +COPY 60-postgresql-shm.conf /etc/sysctl.d/ COPY config.sh create-postgres.sql /docker-entrypoint-initdb.d/ - -COPY 60-postgresql-shm.conf /etc/sysctl.d/60-postgresql-shm.conf +COPY postgresql.conf /tmp/ diff --git a/toolset/databases/postgres/postgresql.conf b/toolset/databases/postgres/postgresql.conf index c241696206d..72c94956692 100644 --- a/toolset/databases/postgres/postgresql.conf +++ b/toolset/databases/postgres/postgresql.conf @@ -1,144 +1,35 @@ # For a full conf file see: # https://github.com/TechEmpower/FrameworkBenchmarks/blob/d8f043d183d1ccbba41157bd57314ef61059edb8/toolset/databases/postgres/postgresql.conf.sample -listen_addresses = '*' # what IP address(es) to listen on; -max_connections = 2000 # (change requires restart) +listen_addresses = '*' +max_connections = 2000 +ssl = false -ssl = false # (change requires restart) - -# - Memory - # values from: http://blog.pgaddict.com/posts/performance-since-postgresql-7-4-to-9-4-pgbench # details: http://www.postgresql.org/docs/9.4/static/runtime-config-resource.html # http://www.postgresql.org/docs/9.4/static/runtime-config-wal.html # http://www.postgresql.org/docs/9.4/static/runtime-config-query.html -shared_buffers = 256MB # min 128kB -work_mem = 64MB # min 64kB -maintenance_work_mem = 512MB # min 1MB -# checkpoint_segments = 64 -checkpoint_completion_target = 0.9 -effective_cache_size = 8GB - -# when executed on the SSD (otherwise 4) -random_page_cost = 2 - -shared_preload_libraries = 'pg_stat_statements' # (change requires restart) -pg_stat_statements.track = all -pg_stat_statements.max = 500000 -track_activity_query_size = 2048 - -#------------------------------------------------------------------------------ -# WRITE AHEAD LOG -#------------------------------------------------------------------------------ - -# - Settings - -wal_level = minimal # minimal, archive, or hot_standby +shared_buffers = 256MB +work_mem = 64MB +maintenance_work_mem = 512MB +wal_level = minimal # WARNING: disabling synchronous commit may be dangerous in certain cases. # See http://www.postgresql.org/docs/current/static/runtime-config-wal.html # for details. synchronous_commit = off -#------------------------------------------------------------------------------ -# REPLICATION -#------------------------------------------------------------------------------ - -# - Master Server - - -# These settings are ignored on a standby server - -max_wal_senders = 0 # max number of walsender processes - # (change requires restart) - -#------------------------------------------------------------------------------ -# ERROR REPORTING AND LOGGING -#------------------------------------------------------------------------------ - -log_line_prefix = '%t ' # special values: - # %a = application name - # %u = user name - # %d = database name - # %r = remote host and port - # %h = remote host - # %p = process ID - # %t = timestamp without milliseconds - # %m = timestamp with milliseconds - # %i = command tag - # %e = SQL state - # %c = session ID - # %l = session line number - # %s = session start timestamp - # %v = virtual transaction ID - # %x = transaction ID (0 if none) - # %q = stop here in non-session - # processes - # %% = '%' - # e.g. '<%u%%%d> ' - -#------------------------------------------------------------------------------ -# CLIENT CONNECTION DEFAULTS -#------------------------------------------------------------------------------ - -# - Statement Behavior - - -#search_path = '"$user",public' # schema names -#default_tablespace = '' # a tablespace name, '' uses the default -#temp_tablespaces = '' # a list of tablespace names, '' uses - # only default tablespace -#check_function_bodies = on -#default_transaction_isolation = 'read committed' -#default_transaction_read_only = off -#default_transaction_deferrable = off -#session_replication_role = 'origin' -#statement_timeout = 0 # in milliseconds, 0 is disabled -#vacuum_freeze_min_age = 50000000 -#vacuum_freeze_table_age = 150000000 -#bytea_output = 'hex' # hex, escape -#xmlbinary = 'base64' -#xmloption = 'content' - -# - Locale and Formatting - - -#datestyle = 'iso, mdy' -#intervalstyle = 'postgres' -#timezone = '(defaults to server environment setting)' -#timezone_abbreviations = 'Default' # Select the set of available time zone - # abbreviations. Currently, there are - # Default - # Australia - # India - # You can create your own file in - # share/timezonesets/. -#extra_float_digits = 0 # min -15, max 3 -#client_encoding = sql_ascii # actually, defaults to database - # encoding - -# These settings are initialized by initdb, but they can be changed. -#lc_messages = 'en_US.UTF-8' # locale for system error message - # strings -#lc_monetary = 'en_US.UTF-8' # locale for monetary formatting -#lc_numeric = 'en_US.UTF-8' # locale for number formatting -#lc_time = 'en_US.UTF-8' # locale for time formatting - -# default configuration for text search -#default_text_search_config = 'pg_catalog.english' - -# - Other Defaults - - -#dynamic_library_path = '$libdir' -#local_preload_libraries = '' - - -#------------------------------------------------------------------------------ -# LOCK MANAGEMENT -#------------------------------------------------------------------------------ +checkpoint_completion_target = 0.9 +max_wal_senders = 0 -#deadlock_timeout = 1s -#max_locks_per_transaction = 64 # min 10 - # (change requires restart) -# Note: Each lock table slot uses ~270 bytes of shared memory, and there are -# max_locks_per_transaction * (max_connections + max_prepared_transactions) -# lock table slots. -max_pred_locks_per_transaction = 256 # min 10 - # (change requires restart) +# when executed on the SSD (otherwise 4) +random_page_cost = 2 +effective_cache_size = 8GB +log_line_prefix = '%t ' +track_activity_query_size = 2048 +shared_preload_libraries = 'pg_stat_statements' +pg_stat_statements.track = all +pg_stat_statements.max = 500000 +max_pred_locks_per_transaction = 256 From ebff4c456bcf936ddd47c83cc1313d9fd2e5df31 Mon Sep 17 00:00:00 2001 From: Joan Miquel Date: Mon, 3 Jun 2024 22:28:48 +0200 Subject: [PATCH 03/45] [php] Fix codeigniter 4.4 (#9086) * Fix codeigniter 4.4 * Update index.php * Update index.php --- frameworks/PHP/codeigniter/public/index.php | 66 +++++---------------- 1 file changed, 15 insertions(+), 51 deletions(-) diff --git a/frameworks/PHP/codeigniter/public/index.php b/frameworks/PHP/codeigniter/public/index.php index 81e10b96dfc..df2853effed 100644 --- a/frameworks/PHP/codeigniter/public/index.php +++ b/frameworks/PHP/codeigniter/public/index.php @@ -1,9 +1,17 @@ systemDirectory, '\\/ ') . DIRECTORY_SEPARATOR . 'bootstrap.php'; - -// Load environment settings from .env files into $_SERVER and $_ENV -require_once SYSTEMPATH . 'Config/DotEnv.php'; -(new CodeIgniter\Config\DotEnv(ROOTPATH))->load(); - -// Define ENVIRONMENT -if (! defined('ENVIRONMENT')) { - define('ENVIRONMENT', env('CI_ENVIRONMENT', 'production')); -} - -// Load Config Cache -// $factoriesCache = new \CodeIgniter\Cache\FactoriesCache(); -// $factoriesCache->load('config'); -// ^^^ Uncomment these lines if you want to use Config Caching. - -/* - * --------------------------------------------------------------- - * GRAB OUR CODEIGNITER INSTANCE - * --------------------------------------------------------------- - * - * The CodeIgniter class contains the core functionality to make - * the application run, and does all the dirty work to get - * the pieces all working together. - */ - -$app = Config\Services::codeigniter(); -$app->initialize(); -//$context = is_cli() ? 'php-cli' : 'web'; -$app->setContext('web'); - -/* - *--------------------------------------------------------------- - * LAUNCH THE APPLICATION - *--------------------------------------------------------------- - * Now that everything is set up, it's time to actually fire - * up the engines and make this app do its thang. - */ - -$app->run(); - -// Save Config Cache -// $factoriesCache->save('config'); -// ^^^ Uncomment this line if you want to use Config Caching. +// LOAD THE FRAMEWORK BOOTSTRAP FILE +require $paths->systemDirectory . '/Boot.php'; -// Exits the application, setting the exit code for CLI-based applications -// that might be watching. -exit(EXIT_SUCCESS); +exit(CodeIgniter\Boot::bootWeb($paths)); From 0a1689868a5c20a8e2f411925ef2156be2d3d54c Mon Sep 17 00:00:00 2001 From: Petrik de Heus Date: Mon, 3 Jun 2024 22:28:59 +0200 Subject: [PATCH 04/45] [crystal/raze] Remove Raze as it is unmaintained (#9075) Raze hasn't been updated in 4 years and the project is archived: https://github.com/samueleaton/raze --- frameworks/Crystal/raze/README.md | 5 - frameworks/Crystal/raze/benchmark_config.json | 28 ----- frameworks/Crystal/raze/config.toml | 19 ---- frameworks/Crystal/raze/raze.cr | 107 ------------------ frameworks/Crystal/raze/raze.dockerfile | 17 --- frameworks/Crystal/raze/run.sh | 7 -- frameworks/Crystal/raze/shard.lock | 22 ---- frameworks/Crystal/raze/shard.yml | 18 --- frameworks/Crystal/raze/views/fortunes.ecr | 20 ---- 9 files changed, 243 deletions(-) delete mode 100644 frameworks/Crystal/raze/README.md delete mode 100644 frameworks/Crystal/raze/benchmark_config.json delete mode 100644 frameworks/Crystal/raze/config.toml delete mode 100644 frameworks/Crystal/raze/raze.cr delete mode 100644 frameworks/Crystal/raze/raze.dockerfile delete mode 100644 frameworks/Crystal/raze/run.sh delete mode 100644 frameworks/Crystal/raze/shard.lock delete mode 100644 frameworks/Crystal/raze/shard.yml delete mode 100644 frameworks/Crystal/raze/views/fortunes.ecr diff --git a/frameworks/Crystal/raze/README.md b/frameworks/Crystal/raze/README.md deleted file mode 100644 index b419b54e543..00000000000 --- a/frameworks/Crystal/raze/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# Crystal-Raze - -This is the [Raze](https://github.com/samueleaton/raze) test of the Framework Benchmarks. Crystal is a new language that closely resembles Ruby with a goal of removing typed variables and parameters (instead inferencing), whilst maintaining top speed through bindings into C. - -Raze is a Modular, light web framework for Crystal https://razecr.com/ diff --git a/frameworks/Crystal/raze/benchmark_config.json b/frameworks/Crystal/raze/benchmark_config.json deleted file mode 100644 index e167df98c2d..00000000000 --- a/frameworks/Crystal/raze/benchmark_config.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "framework": "raze", - "tests": [{ - "default": { - "json_url": "/json", - "db_url": "/db", - "query_url": "/queries?queries=", - "fortune_url": "/fortunes", - "update_url": "/updates?queries=", - "plaintext_url": "/plaintext", - "port": 8080, - "approach": "Realistic", - "classification": "Fullstack", - "database": "Postgres", - "framework": "raze", - "language": "Crystal", - "flavor": "None", - "orm": "micro", - "platform": "None", - "webserver": "None", - "os": "Linux", - "database_os": "Linux", - "display_name": "Raze (PostgreSQL)", - "notes": "", - "versus": "crystal" - } - }] -} diff --git a/frameworks/Crystal/raze/config.toml b/frameworks/Crystal/raze/config.toml deleted file mode 100644 index c1db97a8713..00000000000 --- a/frameworks/Crystal/raze/config.toml +++ /dev/null @@ -1,19 +0,0 @@ -[framework] -name = "raze" - -[main] -urls.plaintext = "/plaintext" -urls.json = "/json" -urls.db = "/db" -urls.query = "/queries?queries=" -urls.update = "/updates?queries=" -urls.fortune = "/fortunes" -approach = "Realistic" -classification = "Fullstack" -database = "Postgres" -database_os = "Linux" -os = "Linux" -orm = "micro" -platform = "None" -webserver = "None" -versus = "crystal" diff --git a/frameworks/Crystal/raze/raze.cr b/frameworks/Crystal/raze/raze.cr deleted file mode 100644 index d27fbfb390d..00000000000 --- a/frameworks/Crystal/raze/raze.cr +++ /dev/null @@ -1,107 +0,0 @@ -require "raze" -require "pg" - -BENCH_DB = DB.open(ENV["DATABASE_URL"]) - -class CONTENT - ID_MAX = 10_000 - JSON = "application/json" - PLAIN = "text/plain" - HTML = "text/html; charset=UTF-8" -end - -private def get_world - id = Random.rand(CONTENT::ID_MAX).succ - random_number = BENCH_DB.query_one("SELECT id, randomNumber FROM world WHERE id = $1", id, as: Int32) - { id: id, randomNumber: random_number } -end - -private def set_world(world) - BENCH_DB.exec("UPDATE world SET randomNumber = $1 WHERE id = $2", world[:randomNumber], world[:id]) - world -end - -private def fortunes - data = Array(NamedTuple(id: Int32, message: String)).new - - BENCH_DB.query_each("SELECT id, message FROM Fortune") do |rs| - data.push({id: rs.read(Int32), message: rs.read(String)}) - end - - data -end - -private def sanitized_query_count(ctx) - queries = ctx.query["queries"].as(String) - queries = queries.to_i? || 1 - queries.clamp(1..500) -end - -# Test 1: JSON Serialization -get "/json" do |ctx| - ctx.response.headers["Server"] = "Raze" - ctx.response.headers["Date"] = HTTP.format_time(Time.now) - ctx.response.content_type = CONTENT::JSON - { message: "Hello, World!" }.to_json -end - -# Postgres Test 2: Single database query -get "/db" do |ctx| - ctx.response.headers["Server"] = "Raze" - ctx.response.headers["Date"] = HTTP.format_time(Time.now) - ctx.response.content_type = CONTENT::JSON - get_world.to_json -end - -# Postgres Test 3: Multiple database query -get "/queries" do |ctx| - results = (1..sanitized_query_count(ctx)).map do - get_world - end - ctx.response.headers["Server"] = "Raze" - ctx.response.headers["Date"] = HTTP.format_time(Time.now) - ctx.response.content_type = CONTENT::JSON - results.to_json -end - -# Postgres Test 4: Fortunes -get "/fortunes" do |ctx| - ctx.response.headers["Server"] = "Raze" - ctx.response.headers["Date"] = HTTP.format_time(Time.now) - ctx.response.content_type = CONTENT::HTML - data = fortunes - additional_fortune = { - id: 0, - message: "Additional fortune added at request time.", - } - data.push(additional_fortune) - - data.sort_by! { |fortune| fortune[:message] } - - render "views/fortunes.ecr" -end - -# Postgres Test 5: Database Updates -get "/updates" do |ctx| - updated = (1..sanitized_query_count(ctx)).map do - set_world({id: get_world[:id], randomNumber: Random.rand(CONTENT::ID_MAX).succ}) - end - ctx.response.headers["Server"] = "Raze" - ctx.response.headers["Date"] = HTTP.format_time(Time.now) - ctx.response.content_type = CONTENT::JSON - updated.to_json -end - -# Test 6: Plaintext -get "/plaintext" do |ctx| - ctx.response.headers["Server"] = "Raze" - ctx.response.headers["Date"] = HTTP.format_time(Time.now) - ctx.response.content_type = CONTENT::PLAIN - "Hello, World!" -end - -Raze.config.logging = false -Raze.config.port = 8080 -Raze.config.env = "production" -Raze.config.reuse_port = true -Raze.run diff --git a/frameworks/Crystal/raze/raze.dockerfile b/frameworks/Crystal/raze/raze.dockerfile deleted file mode 100644 index c83de74401d..00000000000 --- a/frameworks/Crystal/raze/raze.dockerfile +++ /dev/null @@ -1,17 +0,0 @@ -FROM crystallang/crystal:0.26.1 - -WORKDIR /raze -COPY views views -COPY run.sh run.sh -COPY raze.cr raze.cr -COPY shard.lock shard.lock -COPY shard.yml shard.yml - -ENV DATABASE_URL postgres://benchmarkdbuser:benchmarkdbpass@tfb-database:5432/hello_world?initial_pool_size=56&max_pool_size=56&max_idle_pool_size=56 - -RUN shards install -RUN crystal build --release --no-debug raze.cr - -EXPOSE 8080 - -CMD bash run.sh diff --git a/frameworks/Crystal/raze/run.sh b/frameworks/Crystal/raze/run.sh deleted file mode 100644 index a9e373e6683..00000000000 --- a/frameworks/Crystal/raze/run.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -for i in $(seq 1 $(nproc --all)); do - ./raze -p 8080 & -done - -wait diff --git a/frameworks/Crystal/raze/shard.lock b/frameworks/Crystal/raze/shard.lock deleted file mode 100644 index c2aa6f2798d..00000000000 --- a/frameworks/Crystal/raze/shard.lock +++ /dev/null @@ -1,22 +0,0 @@ -version: 1.0 -shards: - db: - github: crystal-lang/crystal-db - version: 0.5.0 - - kilt: - github: jeromegn/kilt - version: 0.4.0 - - pg: - github: will/crystal-pg - version: 0.15.0 - - radix: - github: luislavena/radix - version: 0.3.8 - - raze: - github: samueleaton/raze - version: 0.3.0 - diff --git a/frameworks/Crystal/raze/shard.yml b/frameworks/Crystal/raze/shard.yml deleted file mode 100644 index a18ffe5e277..00000000000 --- a/frameworks/Crystal/raze/shard.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: raze -version: 0.1.0 - -targets: - raze: - main: src/raze.cr - -crystal: 0.26.1 - -license: MIT - -dependencies: - raze: - github: samueleaton/raze - version: 0.3.0 - pg: - github: will/crystal-pg - version: 0.15.0 diff --git a/frameworks/Crystal/raze/views/fortunes.ecr b/frameworks/Crystal/raze/views/fortunes.ecr deleted file mode 100644 index d2842b8bf4b..00000000000 --- a/frameworks/Crystal/raze/views/fortunes.ecr +++ /dev/null @@ -1,20 +0,0 @@ - - - - Fortunes - - - - - - - - <% data.each do |fortune| %> - - - - - <% end %> -
idmessage
<%= fortune[:id] %><%= HTML.escape(fortune[:message]) %>
- - From d69a35f42d164dc06390a6a2f7be3612687317cf Mon Sep 17 00:00:00 2001 From: Petrik de Heus Date: Mon, 3 Jun 2024 22:29:33 +0200 Subject: [PATCH 05/45] [ruby/sinatra] Use Ruby 3.4-rc (#9088) --- frameworks/Ruby/sinatra-sequel/sinatra-sequel-base.dockerfile | 2 +- .../sinatra-sequel-postgres-unicorn-mri.dockerfile | 2 +- .../Ruby/sinatra-sequel/sinatra-sequel-unicorn-mri.dockerfile | 2 +- frameworks/Ruby/sinatra-sequel/sinatra-sequel.dockerfile | 2 +- frameworks/Ruby/sinatra/sinatra-postgres-unicorn-mri.dockerfile | 2 +- frameworks/Ruby/sinatra/sinatra-postgres.dockerfile | 2 +- frameworks/Ruby/sinatra/sinatra-unicorn-mri.dockerfile | 2 +- frameworks/Ruby/sinatra/sinatra.dockerfile | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/frameworks/Ruby/sinatra-sequel/sinatra-sequel-base.dockerfile b/frameworks/Ruby/sinatra-sequel/sinatra-sequel-base.dockerfile index ce6cd9b6316..4fe264d4cb6 100644 --- a/frameworks/Ruby/sinatra-sequel/sinatra-sequel-base.dockerfile +++ b/frameworks/Ruby/sinatra-sequel/sinatra-sequel-base.dockerfile @@ -1,4 +1,4 @@ -FROM ruby:3.3 +FROM ruby:3.4-rc ENV RUBY_YJIT_ENABLE=1 diff --git a/frameworks/Ruby/sinatra-sequel/sinatra-sequel-postgres-unicorn-mri.dockerfile b/frameworks/Ruby/sinatra-sequel/sinatra-sequel-postgres-unicorn-mri.dockerfile index 9ac570ebfb9..939eb97fce5 100644 --- a/frameworks/Ruby/sinatra-sequel/sinatra-sequel-postgres-unicorn-mri.dockerfile +++ b/frameworks/Ruby/sinatra-sequel/sinatra-sequel-postgres-unicorn-mri.dockerfile @@ -1,4 +1,4 @@ -FROM ruby:3.3 +FROM ruby:3.4-rc ENV RUBY_YJIT_ENABLE=1 diff --git a/frameworks/Ruby/sinatra-sequel/sinatra-sequel-unicorn-mri.dockerfile b/frameworks/Ruby/sinatra-sequel/sinatra-sequel-unicorn-mri.dockerfile index 9ab1e96bd1d..78e45656c51 100644 --- a/frameworks/Ruby/sinatra-sequel/sinatra-sequel-unicorn-mri.dockerfile +++ b/frameworks/Ruby/sinatra-sequel/sinatra-sequel-unicorn-mri.dockerfile @@ -1,4 +1,4 @@ -FROM ruby:3.3 +FROM ruby:3.4-rc ENV RUBY_YJIT_ENABLE=1 diff --git a/frameworks/Ruby/sinatra-sequel/sinatra-sequel.dockerfile b/frameworks/Ruby/sinatra-sequel/sinatra-sequel.dockerfile index 4ea3de0b7ad..e36c111221c 100644 --- a/frameworks/Ruby/sinatra-sequel/sinatra-sequel.dockerfile +++ b/frameworks/Ruby/sinatra-sequel/sinatra-sequel.dockerfile @@ -1,4 +1,4 @@ -FROM ruby:3.3 +FROM ruby:3.4-rc ENV RUBY_YJIT_ENABLE=1 diff --git a/frameworks/Ruby/sinatra/sinatra-postgres-unicorn-mri.dockerfile b/frameworks/Ruby/sinatra/sinatra-postgres-unicorn-mri.dockerfile index 36b1c1a4625..a38a0456218 100644 --- a/frameworks/Ruby/sinatra/sinatra-postgres-unicorn-mri.dockerfile +++ b/frameworks/Ruby/sinatra/sinatra-postgres-unicorn-mri.dockerfile @@ -1,4 +1,4 @@ -FROM ruby:3.3 +FROM ruby:3.4-rc ENV RUBY_YJIT_ENABLE=1 diff --git a/frameworks/Ruby/sinatra/sinatra-postgres.dockerfile b/frameworks/Ruby/sinatra/sinatra-postgres.dockerfile index 14025dafb3b..69ec07037dd 100644 --- a/frameworks/Ruby/sinatra/sinatra-postgres.dockerfile +++ b/frameworks/Ruby/sinatra/sinatra-postgres.dockerfile @@ -1,4 +1,4 @@ -FROM ruby:3.3 +FROM ruby:3.4-rc ENV RUBY_YJIT_ENABLE=1 diff --git a/frameworks/Ruby/sinatra/sinatra-unicorn-mri.dockerfile b/frameworks/Ruby/sinatra/sinatra-unicorn-mri.dockerfile index a767ce78bb4..76ca52267f1 100644 --- a/frameworks/Ruby/sinatra/sinatra-unicorn-mri.dockerfile +++ b/frameworks/Ruby/sinatra/sinatra-unicorn-mri.dockerfile @@ -1,4 +1,4 @@ -FROM ruby:3.3 +FROM ruby:3.4-rc ENV RUBY_YJIT_ENABLE=1 diff --git a/frameworks/Ruby/sinatra/sinatra.dockerfile b/frameworks/Ruby/sinatra/sinatra.dockerfile index 3ff4f1f813e..85fe69e9b73 100644 --- a/frameworks/Ruby/sinatra/sinatra.dockerfile +++ b/frameworks/Ruby/sinatra/sinatra.dockerfile @@ -1,4 +1,4 @@ -FROM ruby:3.3 +FROM ruby:3.4-rc ENV RUBY_YJIT_ENABLE=1 From 97f85505292f5d4cd37a914fae51787a3851bffc Mon Sep 17 00:00:00 2001 From: Anton Kirilov Date: Mon, 3 Jun 2024 21:29:49 +0100 Subject: [PATCH 06/45] toolset: Update colorama to version 0.4.6 (#9082) --- Dockerfile | 4 +++- frameworks/C/h2o/benchmark_config.json | 1 + toolset/run-tests.py | 4 ++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index e5df65ea716..4325f036734 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,7 +18,10 @@ RUN apt-get -yqq update && \ libpq-dev \ pkg-config \ python3 \ + python3-colorama \ python3-dev \ + python3-dnspython \ + python3-packaging \ python3-pip \ python3-psutil \ python3-psycopg2 \ @@ -28,7 +31,6 @@ RUN apt-get -yqq update && \ # Ubuntu's equivalent packages are too old and/or broken. pip3 install \ --break-system-packages \ - colorama==0.3.1 \ docker==7.0.0 \ mysqlclient==2.2.4 \ pymongo==4.7.2 diff --git a/frameworks/C/h2o/benchmark_config.json b/frameworks/C/h2o/benchmark_config.json index 1e222e90ce8..4fc6065316e 100644 --- a/frameworks/C/h2o/benchmark_config.json +++ b/frameworks/C/h2o/benchmark_config.json @@ -1,5 +1,6 @@ { "framework": "h2o", + "maintainers": ["volyrique"], "tests": [{ "default": { "json_url": "/json", diff --git a/toolset/run-tests.py b/toolset/run-tests.py index c226edece26..a70fff3a490 100644 --- a/toolset/run-tests.py +++ b/toolset/run-tests.py @@ -10,8 +10,8 @@ from toolset.utils.output_helper import log # Enable cross-platform colored output -from colorama import init, Fore -init() +from colorama import Fore, just_fix_windows_console +just_fix_windows_console() class StoreSeqAction(argparse.Action): From 3670cf1211a93d55c5a13fde606f03dcaf720b68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E5=88=80?= Date: Tue, 4 Jun 2024 04:30:02 +0800 Subject: [PATCH 07/45] update smart-servlet to 1.4 (#9081) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * update smart-servlet to 0.1.3-SNAPSHOT * update aio-enhance to 1.0.3-SNAPSHOT * smart-servlet bugfix * bugfix * update smart-socket to 1.5.6-SNAPSHOT * remove file * update aio-enhance to 1.0.4-SNAPSHOT * 优化代码 * 优化代码 * update smart-socket to 1.5.6 * config threadNum * update smart-socket to 1.5.7-SNAPSHOT * 优化代码 * update smart-socket to 1.5.10-SNAPSHOT * 优化代码 * 优化代码 * 优化代码 * 异常aio-enhance * 优化代码 * 优化代码 * 优化代码 * remove aio-pro * remove headerLimiter * update hikaricp version * replace json util * 更新线程模型 * upgrade smart-servlet to 0.1.9-SNAPSHOT * config thread num * config thread num * revert code * revert code * upgrade smart-servlet to 0.2.1-SNAPSHOT * upgrade smart-servlet to 0.6-SNAPSHOT * upgrade smart-servlet to 0.6-SNAPSHOT * upgrade smart-servlet to 0.6-SNAPSHOT * upgrade smart-servlet to 0.6-SNAPSHOT * upgrade smart-servlet to 0.6-SNAPSHOT * upgrade smart-servlet to 0.6-SNAPSHOT * upgrade smart-servlet to 0.6-SNAPSHOT * upgrade smart-servlet to 1.0-SNAPSHOT * upgrade smart-servlet to 1.4 * upgrade smart-servlet to 1.5-SNAPSHOT * 启用虚拟线程 * 启用虚拟线程 --- frameworks/Java/smart-socket/pom.xml | 6 +-- .../smart-socket-smart-servlet.dockerfile | 2 +- .../Java/smart-socket/smart-socket.dockerfile | 2 +- .../java/org/smartboot/http/Bootstrap.java | 1 + .../http/MultipleQueriesHandler.java | 48 +++++++++++-------- .../smartboot/http/SingleQueryHandler.java | 35 ++++++++------ .../java/org/smartboot/servlet/Bootstrap.java | 6 ++- 7 files changed, 60 insertions(+), 40 deletions(-) diff --git a/frameworks/Java/smart-socket/pom.xml b/frameworks/Java/smart-socket/pom.xml index 376f82878f7..239721f8cba 100644 --- a/frameworks/Java/smart-socket/pom.xml +++ b/frameworks/Java/smart-socket/pom.xml @@ -8,10 +8,10 @@ jar UTF-8 - 17 - 17 + 21 + 21 2.17.1 - 1.0-SNAPSHOT + 1.5-SNAPSHOT 5.0.0 0.9.23 diff --git a/frameworks/Java/smart-socket/smart-socket-smart-servlet.dockerfile b/frameworks/Java/smart-socket/smart-socket-smart-servlet.dockerfile index 8b1cbe79930..bb0b9258ec4 100644 --- a/frameworks/Java/smart-socket/smart-socket-smart-servlet.dockerfile +++ b/frameworks/Java/smart-socket/smart-socket-smart-servlet.dockerfile @@ -1,4 +1,4 @@ -FROM maven:3.8.6-openjdk-18-slim as maven +FROM maven:3.9.7-amazoncorretto-21 as maven WORKDIR /smart-socket COPY pom.xml pom.xml COPY src src diff --git a/frameworks/Java/smart-socket/smart-socket.dockerfile b/frameworks/Java/smart-socket/smart-socket.dockerfile index b40ad2c8d43..4890bd04a06 100644 --- a/frameworks/Java/smart-socket/smart-socket.dockerfile +++ b/frameworks/Java/smart-socket/smart-socket.dockerfile @@ -1,4 +1,4 @@ -FROM maven:3.8.6-openjdk-18-slim as maven +FROM maven:3.9.7-amazoncorretto-21 as maven WORKDIR /smart-socket COPY pom.xml pom.xml COPY src src diff --git a/frameworks/Java/smart-socket/src/main/java/org/smartboot/http/Bootstrap.java b/frameworks/Java/smart-socket/src/main/java/org/smartboot/http/Bootstrap.java index 3d26a672e59..06753113440 100755 --- a/frameworks/Java/smart-socket/src/main/java/org/smartboot/http/Bootstrap.java +++ b/frameworks/Java/smart-socket/src/main/java/org/smartboot/http/Bootstrap.java @@ -51,6 +51,7 @@ public void handle(HttpRequest request, HttpResponse response) throws IOExceptio HttpBootstrap bootstrap = new HttpBootstrap(); bootstrap.configuration() .threadNum(cpuNum) + .headerLimiter(0) .readBufferSize(1024 * 4) .writeBufferSize(1024 * 4) .readMemoryPool(16384 * 1024 * 4) diff --git a/frameworks/Java/smart-socket/src/main/java/org/smartboot/http/MultipleQueriesHandler.java b/frameworks/Java/smart-socket/src/main/java/org/smartboot/http/MultipleQueriesHandler.java index d623f3bf1de..61b9f66b344 100644 --- a/frameworks/Java/smart-socket/src/main/java/org/smartboot/http/MultipleQueriesHandler.java +++ b/frameworks/Java/smart-socket/src/main/java/org/smartboot/http/MultipleQueriesHandler.java @@ -11,6 +11,7 @@ import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; +import java.util.concurrent.CompletableFuture; import java.util.concurrent.ThreadLocalRandom; /** @@ -25,28 +26,35 @@ public MultipleQueriesHandler(DataSource dataSource) { } @Override - public void handle(HttpRequest httpRequest, HttpResponse response) throws IOException { - int queries = Math.min(Math.max(NumberUtils.toInt(httpRequest.getParameter("queries"), 1), 1), 500); - World[] worlds = new World[queries]; - try (Connection connection = dataSource.getConnection(); - PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM World WHERE id=?");) { - - for (int i = 0; i < queries; i++) { - preparedStatement.setInt(1, getRandomNumber()); - ResultSet resultSet = preparedStatement.executeQuery(); - resultSet.next(); - World world = new World(); - world.setId(resultSet.getInt(1)); - world.setRandomNumber(resultSet.getInt(2)); - worlds[i] = world; - preparedStatement.clearParameters(); + public void handle(HttpRequest httpRequest, HttpResponse response, CompletableFuture completableFuture) throws IOException { + Thread.startVirtualThread(() -> { + try { + int queries = Math.min(Math.max(NumberUtils.toInt(httpRequest.getParameter("queries"), 1), 1), 500); + World[] worlds = new World[queries]; + try (Connection connection = dataSource.getConnection(); + PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM World WHERE id=?");) { + + for (int i = 0; i < queries; i++) { + preparedStatement.setInt(1, getRandomNumber()); + ResultSet resultSet = preparedStatement.executeQuery(); + resultSet.next(); + World world = new World(); + world.setId(resultSet.getInt(1)); + world.setRandomNumber(resultSet.getInt(2)); + worlds[i] = world; + preparedStatement.clearParameters(); + } + + } catch (SQLException throwables) { + throwables.printStackTrace(); + } + response.setContentType("application/json"); + JsonUtil.writeJsonBytes(response, worlds); + } finally { + completableFuture.complete(null); } + }); - } catch (SQLException throwables) { - throwables.printStackTrace(); - } - response.setContentType("application/json"); - JsonUtil.writeJsonBytes(response, worlds); } protected int getRandomNumber() { diff --git a/frameworks/Java/smart-socket/src/main/java/org/smartboot/http/SingleQueryHandler.java b/frameworks/Java/smart-socket/src/main/java/org/smartboot/http/SingleQueryHandler.java index e72f4b06433..b69495d1a5e 100644 --- a/frameworks/Java/smart-socket/src/main/java/org/smartboot/http/SingleQueryHandler.java +++ b/frameworks/Java/smart-socket/src/main/java/org/smartboot/http/SingleQueryHandler.java @@ -10,6 +10,7 @@ import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; +import java.util.concurrent.CompletableFuture; import java.util.concurrent.ThreadLocalRandom; /** @@ -24,20 +25,26 @@ public SingleQueryHandler(DataSource dataSource) { } @Override - public void handle(HttpRequest httpRequest, HttpResponse response) throws IOException { - World world = new World(); - try (Connection connection = dataSource.getConnection(); - PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM World WHERE id=?");) { - preparedStatement.setInt(1, getRandomNumber()); - ResultSet resultSet = preparedStatement.executeQuery(); - resultSet.next(); - world.setId(resultSet.getInt(1)); - world.setRandomNumber(resultSet.getInt(2)); - } catch (SQLException throwables) { - throwables.printStackTrace(); - } - response.setContentType("application/json"); - JsonUtil.writeJsonBytes(response, world); + public void handle(HttpRequest httpRequest, HttpResponse response, CompletableFuture completableFuture) throws IOException { + Thread.startVirtualThread(() -> { + try { + World world = new World(); + try (Connection connection = dataSource.getConnection(); PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM World WHERE id=?");) { + preparedStatement.setInt(1, getRandomNumber()); + ResultSet resultSet = preparedStatement.executeQuery(); + resultSet.next(); + world.setId(resultSet.getInt(1)); + world.setRandomNumber(resultSet.getInt(2)); + } catch (SQLException throwables) { + throwables.printStackTrace(); + } + response.setContentType("application/json"); + JsonUtil.writeJsonBytes(response, world); + } finally { + completableFuture.complete(null); + } + }); + } protected int getRandomNumber() { diff --git a/frameworks/Java/smart-socket/src/main/java/org/smartboot/servlet/Bootstrap.java b/frameworks/Java/smart-socket/src/main/java/org/smartboot/servlet/Bootstrap.java index 681ad1a7593..b6691bfd359 100644 --- a/frameworks/Java/smart-socket/src/main/java/org/smartboot/servlet/Bootstrap.java +++ b/frameworks/Java/smart-socket/src/main/java/org/smartboot/servlet/Bootstrap.java @@ -17,7 +17,10 @@ public class Bootstrap { public static void main(String[] args) throws Throwable { ContainerRuntime containerRuntime = new ContainerRuntime(); // plaintext - ServletContextRuntime applicationRuntime = new ServletContextRuntime("/"); + ServletContextRuntime applicationRuntime = new ServletContextRuntime(null, Thread.currentThread().getContextClassLoader(), "/"); + applicationRuntime.setVendorProvider(response -> { + + }); ServletInfo plainTextServletInfo = new ServletInfo(); plainTextServletInfo.setServletName("plaintext"); plainTextServletInfo.setServletClass(HelloWorldServlet.class.getName()); @@ -38,6 +41,7 @@ public static void main(String[] args) throws Throwable { bootstrap.configuration() .threadNum(cpuNum) .bannerEnabled(false) + .headerLimiter(0) .readBufferSize(1024 * 4) .writeBufferSize(1024 * 4) .readMemoryPool(16384 * 1024 * 4) From 9e7b65a5078dd8b8e6514a41196d65f1a81125d9 Mon Sep 17 00:00:00 2001 From: Petrik de Heus Date: Mon, 3 Jun 2024 22:30:46 +0200 Subject: [PATCH 08/45] [crystal|grip] Update dependencies (#9076) --- frameworks/Crystal/grip/grip.cr | 2 +- frameworks/Crystal/grip/grip.dockerfile | 2 +- frameworks/Crystal/grip/shard.yml | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/frameworks/Crystal/grip/grip.cr b/frameworks/Crystal/grip/grip.cr index 3a910eebdd3..1b8a64b6667 100644 --- a/frameworks/Crystal/grip/grip.cr +++ b/frameworks/Crystal/grip/grip.cr @@ -121,7 +121,7 @@ end class Application < Grip::Application def initialize - super(environment: "production", serve_static: false) + super(environment: "production") get "/json", Json get "/plaintext", Plaintext diff --git a/frameworks/Crystal/grip/grip.dockerfile b/frameworks/Crystal/grip/grip.dockerfile index 244aa5dbf70..4d98926effb 100644 --- a/frameworks/Crystal/grip/grip.dockerfile +++ b/frameworks/Crystal/grip/grip.dockerfile @@ -1,4 +1,4 @@ -FROM crystallang/crystal:1.0.0 +FROM crystallang/crystal:1.12.1 WORKDIR /grip COPY views views diff --git a/frameworks/Crystal/grip/shard.yml b/frameworks/Crystal/grip/shard.yml index e5500bfe11f..ed1f5ab0a2e 100644 --- a/frameworks/Crystal/grip/shard.yml +++ b/frameworks/Crystal/grip/shard.yml @@ -4,11 +4,11 @@ version: 0.2.0 dependencies: grip: github: grip-framework/grip - version: 2.0.0 + version: 3.0.0 pg: github: will/crystal-pg - version: 0.26.0 + version: 0.28.0 targets: grip: main: grip.cr From 251d2e86b1ad31aa32b62dba87cb17bd20445219 Mon Sep 17 00:00:00 2001 From: itrofimow Date: Tue, 4 Jun 2024 00:31:00 +0400 Subject: [PATCH 09/45] [C++] [userver] bump userver commit (#9080) --- frameworks/C++/userver/userver-bare.dockerfile | 2 +- frameworks/C++/userver/userver.dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/frameworks/C++/userver/userver-bare.dockerfile b/frameworks/C++/userver/userver-bare.dockerfile index 59704d05f25..4605e6bb582 100644 --- a/frameworks/C++/userver/userver-bare.dockerfile +++ b/frameworks/C++/userver/userver-bare.dockerfile @@ -6,7 +6,7 @@ RUN apt update && \ WORKDIR /src RUN git clone https://github.com/userver-framework/userver.git && \ - cd userver && git checkout c2ca5454f0b0e93dd0a2e082904dedda5cda3052 + cd userver && git checkout ec1a3b07793f8d4cd0968cd61d8e6079d667a1e7 COPY userver_benchmark/ ./ RUN mkdir build && cd build && \ diff --git a/frameworks/C++/userver/userver.dockerfile b/frameworks/C++/userver/userver.dockerfile index 667d7ebd96b..cbdceea1862 100644 --- a/frameworks/C++/userver/userver.dockerfile +++ b/frameworks/C++/userver/userver.dockerfile @@ -6,7 +6,7 @@ RUN apt update && \ WORKDIR /src RUN git clone https://github.com/userver-framework/userver.git && \ - cd userver && git checkout c2ca5454f0b0e93dd0a2e082904dedda5cda3052 + cd userver && git checkout ec1a3b07793f8d4cd0968cd61d8e6079d667a1e7 COPY userver_benchmark/ ./ RUN mkdir build && cd build && \ From 4f74e649a44ab79950214b6340263413395f45ea Mon Sep 17 00:00:00 2001 From: Petrik de Heus Date: Mon, 3 Jun 2024 22:31:12 +0200 Subject: [PATCH 10/45] [ruby/agoo] Update dependencies (#9070) * [ruby/agoo] Update dependencies Also fix flakiness by sorting worlds on id in batch update. * [agoo] Upgrade to Ruby 3.4-rc --- frameworks/Ruby/agoo/Gemfile.lock | 14 ++++++++------ frameworks/Ruby/agoo/agoo.dockerfile | 2 +- frameworks/Ruby/agoo/app.rb | 2 +- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/frameworks/Ruby/agoo/Gemfile.lock b/frameworks/Ruby/agoo/Gemfile.lock index daf0ea3b35d..8df20e4179a 100644 --- a/frameworks/Ruby/agoo/Gemfile.lock +++ b/frameworks/Ruby/agoo/Gemfile.lock @@ -1,11 +1,13 @@ GEM remote: https://rubygems.org/ specs: - agoo (2.8.3) - connection_pool (2.2.2) - oj (3.7.12) - pg (1.1.4) - rack (2.0.7) + agoo (2.15.10) + bigdecimal (3.1.8) + connection_pool (2.4.1) + oj (3.16.3) + bigdecimal (>= 3.0) + pg (1.5.6) + rack (3.0.11) PLATFORMS ruby @@ -18,4 +20,4 @@ DEPENDENCIES rack BUNDLED WITH - 1.17.2 + 2.5.10 diff --git a/frameworks/Ruby/agoo/agoo.dockerfile b/frameworks/Ruby/agoo/agoo.dockerfile index 964e91aa5a5..bb4e363b687 100644 --- a/frameworks/Ruby/agoo/agoo.dockerfile +++ b/frameworks/Ruby/agoo/agoo.dockerfile @@ -1,4 +1,4 @@ -FROM ruby:3.3 +FROM ruby:3.4-rc RUN apt-get update -q \ && apt-get install --no-install-recommends -q -y \ diff --git a/frameworks/Ruby/agoo/app.rb b/frameworks/Ruby/agoo/app.rb index 498c0ece93b..cd4f7165a31 100644 --- a/frameworks/Ruby/agoo/app.rb +++ b/frameworks/Ruby/agoo/app.rb @@ -165,7 +165,7 @@ def self.call(req) class UpdatesHandler < BaseHandler def self.call(req) queries = extract_queries_param req - records = ALL_IDS.sample(queries).map do |id| + records = ALL_IDS.sample(queries).sort.map do |id| world = get_one_record(id) world['randomnumber'] = get_one_random_number world From 7e65c3ca7b88210b3c6cd6716c90a253bb305f04 Mon Sep 17 00:00:00 2001 From: Petrik de Heus Date: Fri, 7 Jun 2024 23:52:25 +0200 Subject: [PATCH 11/45] Remove unmaintained Polkadot framework (#9099) Polkadot currently fails and hasn't been updated in 4 years. https://github.com/lukeed/polkadot --- frameworks/JavaScript/polkadot/.npmrc | 1 - frameworks/JavaScript/polkadot/README.md | 49 ---------- frameworks/JavaScript/polkadot/app.js | 18 ---- .../JavaScript/polkadot/benchmark_config.json | 90 ------------------- frameworks/JavaScript/polkadot/config.toml | 61 ------------- .../JavaScript/polkadot/drivers/mongodb.js | 16 ---- .../JavaScript/polkadot/drivers/mysql.js | 24 ----- .../JavaScript/polkadot/drivers/postgres.js | 20 ----- frameworks/JavaScript/polkadot/helper.js | 8 -- frameworks/JavaScript/polkadot/init.js | 66 -------------- frameworks/JavaScript/polkadot/package.json | 13 --- .../polkadot/polkadot-mongodb.dockerfile | 12 --- .../polkadot/polkadot-mysql.dockerfile | 12 --- .../polkadot/polkadot-postgres.dockerfile | 12 --- .../JavaScript/polkadot/polkadot.dockerfile | 11 --- 15 files changed, 413 deletions(-) delete mode 100644 frameworks/JavaScript/polkadot/.npmrc delete mode 100644 frameworks/JavaScript/polkadot/README.md delete mode 100755 frameworks/JavaScript/polkadot/app.js delete mode 100644 frameworks/JavaScript/polkadot/benchmark_config.json delete mode 100644 frameworks/JavaScript/polkadot/config.toml delete mode 100644 frameworks/JavaScript/polkadot/drivers/mongodb.js delete mode 100644 frameworks/JavaScript/polkadot/drivers/mysql.js delete mode 100644 frameworks/JavaScript/polkadot/drivers/postgres.js delete mode 100644 frameworks/JavaScript/polkadot/helper.js delete mode 100644 frameworks/JavaScript/polkadot/init.js delete mode 100644 frameworks/JavaScript/polkadot/package.json delete mode 100644 frameworks/JavaScript/polkadot/polkadot-mongodb.dockerfile delete mode 100644 frameworks/JavaScript/polkadot/polkadot-mysql.dockerfile delete mode 100644 frameworks/JavaScript/polkadot/polkadot-postgres.dockerfile delete mode 100644 frameworks/JavaScript/polkadot/polkadot.dockerfile diff --git a/frameworks/JavaScript/polkadot/.npmrc b/frameworks/JavaScript/polkadot/.npmrc deleted file mode 100644 index 43c97e719a5..00000000000 --- a/frameworks/JavaScript/polkadot/.npmrc +++ /dev/null @@ -1 +0,0 @@ -package-lock=false diff --git a/frameworks/JavaScript/polkadot/README.md b/frameworks/JavaScript/polkadot/README.md deleted file mode 100644 index 275cf83227d..00000000000 --- a/frameworks/JavaScript/polkadot/README.md +++ /dev/null @@ -1,49 +0,0 @@ -# Polkadot Benchmarking Test - -This is the [`polkadot`](https://github.com/lukeed/polkadot) portion of a [benchmarking test suite](../) comparing a variety of web development platforms. - -Information about Polkadot can be found at https://github.com/lukeed/polkadot - -## Database Drivers - -There are individual handlers for each DB approach. The logic for each of them are found here: - -* [MySQL](drivers/mysql.js) -* [MongoDB](drivers/mongodb.js) -* [PostgreSQL](drivers/postgres.js) - -There are **no database endpoints** or drivers attached by default.
-To initialize the application with one of these, run any _one_ of the following commands: - -```sh -$ DATABASE=mysql node app.js -$ DATABASE=mongodb node app.js -$ DATABASE=postgres node app.js -``` - -## Test Endpoints - -> Visit the test requirements [here](https://github.com/TechEmpower/FrameworkBenchmarks/wiki/Project-Information-Framework-Tests-Overview) - -```sh -$ curl localhost:8080/json -$ curl localhost:8080/plaintext - -# The following are only available w/ DATABASE -# --- - -$ curl localhost:8080/db -$ curl localhost:8080/fortunes - -$ curl localhost:8080/updates?queries= -$ curl localhost:8080/updates?queries=2 -$ curl localhost:8080/updates?queries=1000 -$ curl localhost:8080/updates?queries=foo -$ curl localhost:8080/updates?queries=0 - -$ curl localhost:8080/queries?queries= -$ curl localhost:8080/queries?queries=2 -$ curl localhost:8080/queries?queries=1000 -$ curl localhost:8080/queries?queries=foo -$ curl localhost:8080/queries?queries=0 -``` diff --git a/frameworks/JavaScript/polkadot/app.js b/frameworks/JavaScript/polkadot/app.js deleted file mode 100755 index 0b34b676af4..00000000000 --- a/frameworks/JavaScript/polkadot/app.js +++ /dev/null @@ -1,18 +0,0 @@ -const cluster = require('cluster'); -const numCPUs = require('os').cpus().length; - -if (cluster.isMaster) { - // Fork workers. - for (let i = 0; i < numCPUs; i++) { - cluster.fork(); - } - - console.log('Master starting ' + new Date().toISOString()); - - cluster.on('exit', () => { - process.exit(1); - }); -} else { - // worker task - require('./init'); -} diff --git a/frameworks/JavaScript/polkadot/benchmark_config.json b/frameworks/JavaScript/polkadot/benchmark_config.json deleted file mode 100644 index 614c55d27ba..00000000000 --- a/frameworks/JavaScript/polkadot/benchmark_config.json +++ /dev/null @@ -1,90 +0,0 @@ -{ - "framework": "polkadot", - "tests": [ - { - "default": { - "json_url": "/json", - "plaintext_url": "/plaintext", - "port": 8080, - "approach": "Realistic", - "classification": "Platform", - "database": "None", - "framework": "polkadot", - "language": "JavaScript", - "flavor": "NodeJS", - "orm": "Raw", - "platform": "nodejs", - "webserver": "None", - "os": "Linux", - "database_os": "Linux", - "display_name": "polkadot", - "notes": "", - "versus": "nodejs" - }, - "mysql": { - "dockerfile": "polkadot-mysql.dockerfile", - "db_url": "/db", - "query_url": "/queries?queries=", - "fortune_url": "/fortunes", - "update_url": "/updates?queries=", - "port": 8080, - "approach": "Realistic", - "classification": "Platform", - "database": "MySQL", - "framework": "polkadot", - "language": "JavaScript", - "flavor": "NodeJS", - "orm": "Raw", - "platform": "nodejs", - "webserver": "None", - "os": "Linux", - "database_os": "Linux", - "display_name": "polkadot", - "notes": "", - "versus": "nodejs" - }, - "postgres": { - "db_url": "/db", - "query_url": "/queries?queries=", - "fortune_url": "/fortunes", - "update_url": "/updates?queries=", - "port": 8080, - "approach": "Realistic", - "classification": "Platform", - "database": "Postgres", - "framework": "polkadot", - "language": "JavaScript", - "flavor": "NodeJS", - "orm": "Raw", - "platform": "None", - "webserver": "None", - "os": "Linux", - "database_os": "Linux", - "display_name": "polkadot", - "notes": "", - "versus": "nodejs" - }, - "mongodb": { - "db_url": "/db", - "query_url": "/queries?queries=", - "fortune_url": "/fortunes", - "update_url": "/updates?queries=", - "port": 8080, - "approach": "Realistic", - "classification": "Platform", - "database": "MongoDB", - "framework": "polkadot", - "language": "JavaScript", - "flavor": "NodeJS", - "orm": "Raw", - "platform": "None", - "webserver": "None", - "os": "Linux", - "database_os": "Linux", - "display_name": "polkadot", - "notes": "", - "versus": "nodejs" - } - } - ] -} diff --git a/frameworks/JavaScript/polkadot/config.toml b/frameworks/JavaScript/polkadot/config.toml deleted file mode 100644 index 571a537149f..00000000000 --- a/frameworks/JavaScript/polkadot/config.toml +++ /dev/null @@ -1,61 +0,0 @@ -[framework] -name = "polkadot" - -[main] -urls.plaintext = "/plaintext" -urls.json = "/json" -approach = "Realistic" -classification = "Platform" -database = "None" -database_os = "Linux" -os = "Linux" -orm = "Raw" -platform = "nodejs" -webserver = "None" -versus = "nodejs" - -[mongodb] -urls.db = "/db" -urls.query = "/queries?queries=" -urls.update = "/updates?queries=" -urls.fortune = "/fortunes" -approach = "Realistic" -classification = "Platform" -database = "MongoDB" -database_os = "Linux" -os = "Linux" -orm = "Raw" -platform = "None" -webserver = "None" -versus = "nodejs" - -[postgres] -urls.db = "/db" -urls.query = "/queries?queries=" -urls.update = "/updates?queries=" -urls.fortune = "/fortunes" -approach = "Realistic" -classification = "Platform" -database = "Postgres" -database_os = "Linux" -os = "Linux" -orm = "Raw" -platform = "None" -webserver = "None" -versus = "nodejs" - -[mysql] -urls.db = "/db" -urls.query = "/queries?queries=" -urls.update = "/updates?queries=" -urls.fortune = "/fortunes" -approach = "Realistic" -classification = "Platform" -database = "MySQL" -database_os = "Linux" -os = "Linux" -orm = "Raw" -platform = "nodejs" -webserver = "None" -versus = "nodejs" -dockerfile = "polkadot-mysql.dockerfile" diff --git a/frameworks/JavaScript/polkadot/drivers/mongodb.js b/frameworks/JavaScript/polkadot/drivers/mongodb.js deleted file mode 100644 index 6d12fabc90e..00000000000 --- a/frameworks/JavaScript/polkadot/drivers/mongodb.js +++ /dev/null @@ -1,16 +0,0 @@ -const { MongoClient } = require('mongodb'); - -let World, Fortune; -const projection = { _id:0 }; - -MongoClient.connect('mongodb://tfb-database:27017', { useNewUrlParser:true }, (err, ctx) => { - const DB = ctx.db('hello_world'); - Fortune = DB.collection('fortune'); - World = DB.collection('world'); -}); - -exports.fortunes = () => Fortune.find({}, { projection }).toArray(); - -exports.find = id => World.findOne({ id }, { projection }); - -exports.update = obj => World.replaceOne({ id:obj.id }, obj); diff --git a/frameworks/JavaScript/polkadot/drivers/mysql.js b/frameworks/JavaScript/polkadot/drivers/mysql.js deleted file mode 100644 index 24ce23bf247..00000000000 --- a/frameworks/JavaScript/polkadot/drivers/mysql.js +++ /dev/null @@ -1,24 +0,0 @@ -const { createConnection } = require('mysql'); - -const connection = createConnection({ - host: 'tfb-database', - user: 'benchmarkdbuser', - password: 'benchmarkdbpass', - database: 'hello_world' -}); - -connection.connect(); - -function query(text, values) { - return new Promise((res, rej) => { - connection.query(text, values || [], (err, results) => { - return err ? rej(err) : res(results); - }); - }); -} - -exports.fortunes = () => query('SELECT * FROM fortune'); - -exports.find = id => query('SELECT * FROM world WHERE id = ?', [id]).then(arr => arr[0]); - -exports.update = obj => query('UPDATE world SET randomNumber = ? WHERE id = ?', [obj.randomNumber, obj.id]); diff --git a/frameworks/JavaScript/polkadot/drivers/postgres.js b/frameworks/JavaScript/polkadot/drivers/postgres.js deleted file mode 100644 index 2c8388823a6..00000000000 --- a/frameworks/JavaScript/polkadot/drivers/postgres.js +++ /dev/null @@ -1,20 +0,0 @@ -const { Client } = require('pg'); - -const client = new Client({ - host: 'tfb-database', - user: 'benchmarkdbuser', - password: 'benchmarkdbpass', - database: 'hello_world' -}); - -client.connect(); - -function query(text, values) { - return client.query(text, values || []).then(r => r.rows); -} - -exports.fortunes = () => query('SELECT * FROM fortune'); - -exports.find = id => query('SELECT * FROM world WHERE id = $1', [id]).then(arr => arr[0]); - -exports.update = obj => query('UPDATE world SET randomNumber = $1 WHERE id = $2', [obj.randomNumber, obj.id]); diff --git a/frameworks/JavaScript/polkadot/helper.js b/frameworks/JavaScript/polkadot/helper.js deleted file mode 100644 index abdec861082..00000000000 --- a/frameworks/JavaScript/polkadot/helper.js +++ /dev/null @@ -1,8 +0,0 @@ -exports.random = () => Math.floor(Math.random() * 1e4) + 1; - -exports.parse = queries => Math.min(Math.max(parseInt(queries, 10) || 1, 1), 500); - -exports.fortune = { - id: 0, - message: 'Additional fortune added at request time.' -}; diff --git a/frameworks/JavaScript/polkadot/init.js b/frameworks/JavaScript/polkadot/init.js deleted file mode 100644 index 544a3ce92fc..00000000000 --- a/frameworks/JavaScript/polkadot/init.js +++ /dev/null @@ -1,66 +0,0 @@ -const polkadot = require('polkadot'); -const XSS = require('html-escaper'); -const helper = require('./helper'); - -const { DATABASE } = process.env; -const DRIVER = DATABASE && require(`./drivers/${DATABASE}`); - -polkadot(async (req, res) => { - res.setHeader('Server', 'Polkadot'); - - if (req.path === '/json') { - res.setHeader('Content-Type', 'application/json'); - return { message: 'Hello, World!' }; - } - - if (req.path === '/plaintext') { - return 'Hello, World!'; - } - - if (DRIVER) { - if (req.path === '/db') { - res.setHeader('Content-Type', 'application/json'); - return DRIVER.find(helper.random()); - } - - if (req.path === '/queries') { - let arr=[], num=helper.parse(req.query.queries); - while (num-- > 0) arr.push(DRIVER.find(helper.random())); - res.setHeader('Content-Type', 'application/json'); - return Promise.all(arr); - } - - if (req.path === '/fortunes') { - const items = await DRIVER.fortunes(); - items.push(helper.fortune); - - items.sort((a, b) => a.message.localeCompare(b.message)); - - let i=0, html='Fortunes'; - for (; i < items.length; i++) html += ``; - html += '
idmessage
${items[i].id}${XSS.escape(items[i].message)}
'; - - res.setHeader('Content-Type', 'text/html; charset=utf-8'); - return html; - } - - if (req.path === '/updates') { - let reads=[], num=helper.parse(req.query.queries); - while (num-- > 0) reads.push(DRIVER.find(helper.random())); - const rows = await Promise.all(reads); - - let i=0, writes=[]; - for (; i < rows.length; i++) { - rows[i].randomNumber = helper.random(); - writes.push(DRIVER.update(rows[i])); - } - - await Promise.all(writes); - res.setHeader('Content-Type', 'application/json'); - return rows; - } - } -}).listen(8080, '0.0.0.0', err => { - if (err) throw err; - console.log(`Worker started and listening on http://0.0.0.0:8080 ${new Date().toISOString()}`); -}); diff --git a/frameworks/JavaScript/polkadot/package.json b/frameworks/JavaScript/polkadot/package.json deleted file mode 100644 index 6f595e761db..00000000000 --- a/frameworks/JavaScript/polkadot/package.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "private": true, - "name": "polkadot-tfb", - "version": "0.0.0", - "main": "app.js", - "dependencies": { - "html-escaper": "1.0.1", - "mongodb": "3.2.2", - "mysql": "2.16.0", - "pg": "7.9.0", - "polkadot": "1.0.0" - } -} diff --git a/frameworks/JavaScript/polkadot/polkadot-mongodb.dockerfile b/frameworks/JavaScript/polkadot/polkadot-mongodb.dockerfile deleted file mode 100644 index be4249701f9..00000000000 --- a/frameworks/JavaScript/polkadot/polkadot-mongodb.dockerfile +++ /dev/null @@ -1,12 +0,0 @@ -FROM node:12.3.1-slim - -COPY ./ ./ - -RUN npm install - -ENV NODE_ENV production -ENV DATABASE mongodb - -EXPOSE 8080 - -CMD ["node", "app.js"] diff --git a/frameworks/JavaScript/polkadot/polkadot-mysql.dockerfile b/frameworks/JavaScript/polkadot/polkadot-mysql.dockerfile deleted file mode 100644 index 51208eb47db..00000000000 --- a/frameworks/JavaScript/polkadot/polkadot-mysql.dockerfile +++ /dev/null @@ -1,12 +0,0 @@ -FROM node:12.3.1-slim - -COPY ./ ./ - -RUN npm install - -ENV NODE_ENV production -ENV DATABASE mysql - -EXPOSE 8080 - -CMD ["node", "app.js"] diff --git a/frameworks/JavaScript/polkadot/polkadot-postgres.dockerfile b/frameworks/JavaScript/polkadot/polkadot-postgres.dockerfile deleted file mode 100644 index 1a078246bcc..00000000000 --- a/frameworks/JavaScript/polkadot/polkadot-postgres.dockerfile +++ /dev/null @@ -1,12 +0,0 @@ -FROM node:12.3.1-slim - -COPY ./ ./ - -RUN npm install - -ENV NODE_ENV production -ENV DATABASE postgres - -EXPOSE 8080 - -CMD ["node", "app.js"] diff --git a/frameworks/JavaScript/polkadot/polkadot.dockerfile b/frameworks/JavaScript/polkadot/polkadot.dockerfile deleted file mode 100644 index c3337439882..00000000000 --- a/frameworks/JavaScript/polkadot/polkadot.dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -FROM node:12.3.1-slim - -COPY ./ ./ - -RUN npm install - -ENV NODE_ENV production - -EXPOSE 8080 - -CMD ["node", "app.js"] From 5156f6efca39481e444d5149c25db30f30ae1df0 Mon Sep 17 00:00:00 2001 From: Nate Date: Fri, 7 Jun 2024 14:52:55 -0700 Subject: [PATCH 12/45] Fix Reverse order (#9102) * Add --reverse-order option and switch order after each run on citrine * Move reverse ordering to startup script since we run shutdown script twice * Fix reverse order --- toolset/continuous/tfb-startup.sh | 6 ------ 1 file changed, 6 deletions(-) diff --git a/toolset/continuous/tfb-startup.sh b/toolset/continuous/tfb-startup.sh index 866d68135cc..b0be7622bf5 100644 --- a/toolset/continuous/tfb-startup.sh +++ b/toolset/continuous/tfb-startup.sh @@ -25,12 +25,6 @@ docker build -t techempower/tfb \ --build-arg USER_ID=$(id -u) \ --build-arg GROUP_ID=$(id -g) . -if [ -z "$TFB_RUN_ORDER" ]; then - export TFB_RUN_ORDER="reverse" -else - unset TFB_RUN_ORDER -fi - echo "running tfb docker image" docker run \ -e USER_ID=$(id -u) \ From 4f780c0f0a9e85790ed0ebf3743210af7f2da137 Mon Sep 17 00:00:00 2001 From: Petrik de Heus Date: Fri, 7 Jun 2024 23:53:06 +0200 Subject: [PATCH 13/45] Remove unmaintained Duda framework (#9101) Duda is currently failing and hasn't been updated for 8 years. https://github.com/monkey/duda --- frameworks/C/duda/README.md | 29 --------- frameworks/C/duda/benchmark_config.json | 24 ------- frameworks/C/duda/config.toml | 15 ----- frameworks/C/duda/duda.dockerfile | 13 ---- frameworks/C/duda/webservice/Makefile.in | 7 -- frameworks/C/duda/webservice/main.c | 81 ------------------------ 6 files changed, 169 deletions(-) delete mode 100644 frameworks/C/duda/README.md delete mode 100644 frameworks/C/duda/benchmark_config.json delete mode 100644 frameworks/C/duda/config.toml delete mode 100644 frameworks/C/duda/duda.dockerfile delete mode 100644 frameworks/C/duda/webservice/Makefile.in delete mode 100644 frameworks/C/duda/webservice/main.c diff --git a/frameworks/C/duda/README.md b/frameworks/C/duda/README.md deleted file mode 100644 index 7ced12ed71a..00000000000 --- a/frameworks/C/duda/README.md +++ /dev/null @@ -1,29 +0,0 @@ -# Duda I/O Benchmarking Test - -This is the web service used to benchmark Duda I/O web services framework. - -http://duda.io - -## Requirements - -Just the GNU C Compiler and a Linux system running Kernel version >= 2.6.32 - -## Tests available - -### 1. JSON - -URL: /json - -### 6. Plain text - -URL: /plaintext - -## About pending tests - -Most of tests that are related to database query are pending and will be available for the next Round. - -## Contact - -Eduardo Silva - - diff --git a/frameworks/C/duda/benchmark_config.json b/frameworks/C/duda/benchmark_config.json deleted file mode 100644 index e8885751e0a..00000000000 --- a/frameworks/C/duda/benchmark_config.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "framework": "duda", - "tests": [{ - "default": { - "json_url": "/json", - "plaintext_url": "/plaintext", - "port": 2001, - "approach": "Realistic", - "classification": "Platform", - "database": "None", - "framework": "None", - "language": "C", - "flavor": "None", - "orm": "Raw", - "platform": "duda", - "webserver": "Monkey", - "os": "Linux", - "database_os": "Linux", - "display_name": "Duda I/O", - "notes": "", - "versus": "duda" - } - }] -} diff --git a/frameworks/C/duda/config.toml b/frameworks/C/duda/config.toml deleted file mode 100644 index 58b23cba9a5..00000000000 --- a/frameworks/C/duda/config.toml +++ /dev/null @@ -1,15 +0,0 @@ -[framework] -name = "duda" - -[main] -urls.plaintext = "/plaintext" -urls.json = "/json" -approach = "Realistic" -classification = "Platform" -database = "None" -database_os = "Linux" -os = "Linux" -orm = "Raw" -platform = "duda" -webserver = "Monkey" -versus = "duda" diff --git a/frameworks/C/duda/duda.dockerfile b/frameworks/C/duda/duda.dockerfile deleted file mode 100644 index 9b969a75bbe..00000000000 --- a/frameworks/C/duda/duda.dockerfile +++ /dev/null @@ -1,13 +0,0 @@ -FROM python:2.7 - -COPY ./ ./ -# Get v0.31 (no official releases that work 2015-06-25) - -RUN git clone https://github.com/monkey/dudac.git -RUN cd dudac && git checkout 7c3d5b03b09fb4cb5f5e338fff72df2e25e95ef0 && \ - ./dudac -r && \ - ./dudac -s - -EXPOSE 2001 - -CMD ["./dudac/dudac", "-w", "webservice", "-p", "2001"] diff --git a/frameworks/C/duda/webservice/Makefile.in b/frameworks/C/duda/webservice/Makefile.in deleted file mode 100644 index 34e55a2c8b8..00000000000 --- a/frameworks/C/duda/webservice/Makefile.in +++ /dev/null @@ -1,7 +0,0 @@ -NAME = ws -CC = gcc -CFLAGS = -g -Wall -O2 -LDFLAGS = -DEFS = -INCDIR = -OBJECTS = main.o diff --git a/frameworks/C/duda/webservice/main.c b/frameworks/C/duda/webservice/main.c deleted file mode 100644 index 512f0ef8f6d..00000000000 --- a/frameworks/C/duda/webservice/main.c +++ /dev/null @@ -1,81 +0,0 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ - -/* - * Duda I/O Benchmark Tests - * ======================== - * This web service is made for the performance contest made by - * TechEmpower, mode details here: - * - * http://www.techempower.com/benchmarks - * - * At the moment only Tests 1 & 6 are implemented. - */ - -#include "webservice.h" -#include "packages/json/json.h" - -/* Test Macros (Tn) */ -#define JSON_CONTENT_TYPE "Content-Type: application/json" -#define PLAIN_CONTENT_TYPE "Content-Type: text/plain" -#define T6_BODY "Hello, World!" - -DUDA_REGISTER("Duda I/O Benchmark Test", "WS Bench"); - -/* - * Test type 1: JSON serialization - * =============================== - * This test use the JSON API object to compose the JSON response - */ -void cb_json(duda_request_t *dr) -{ - char *body; - int body_len; - json_t *j_root; - - /* Instance the JSON object and compose the content */ - j_root = json->create_object(); - json->add_to_object(j_root, - "message", - json->create_string("Hello, World!")); - - /* Format output to string */ - body = json->print_unformatted_gc(dr, j_root); - body_len = strlen(body); - - /* Delete the JSON tree */ - json->delete(j_root); - - /* Compose the response */ - response->http_status(dr, 200); - response->http_header_n(dr, JSON_CONTENT_TYPE, sizeof(JSON_CONTENT_TYPE) - 1); - response->print(dr, body, body_len); - response->end(dr, NULL); -} - - -/* - * Test type 6: Plaintext - * ====================== - */ -void cb_plaintext(duda_request_t *dr) -{ - response->http_status(dr, 200); - response->http_header_n(dr, PLAIN_CONTENT_TYPE, sizeof(PLAIN_CONTENT_TYPE) - 1); - response->print(dr, T6_BODY, sizeof(T6_BODY) - 1); - response->end(dr, NULL); -} - -int duda_main() -{ - /* load packages */ - duda_load_package(json, "json"); - - /* let this web service own the virtual host */ - conf->service_root(); - - /* set callbacks */ - map->static_add("/json", "cb_json"); /* Test #1 */ - map->static_add("/plaintext", "cb_plaintext"); /* Test #6 */ - - return 0; -} From eab0c1749044945f2108e6cab051808d6953fa6c Mon Sep 17 00:00:00 2001 From: Petrik de Heus Date: Fri, 7 Jun 2024 23:53:34 +0200 Subject: [PATCH 14/45] Remove unmaintained silicon framework (#9100) Silicon hasn't been updated in 4 years and is currently failing. https://github.com/matt-42/silicon --- frameworks/C++/silicon/CMakeLists.txt | 19 ---- frameworks/C++/silicon/README.md | 8 -- frameworks/C++/silicon/benchmark_config.json | 28 ----- frameworks/C++/silicon/build/symbols.hh | 47 -------- frameworks/C++/silicon/build/techempower.hh | 102 ------------------ .../C++/silicon/build/techempower_lwan.cc | 41 ------- .../silicon/build/techempower_microhttpd.cc | 48 --------- frameworks/C++/silicon/config.toml | 19 ---- frameworks/C++/silicon/silicon.dockerfile | 39 ------- 9 files changed, 351 deletions(-) delete mode 100644 frameworks/C++/silicon/CMakeLists.txt delete mode 100644 frameworks/C++/silicon/README.md delete mode 100644 frameworks/C++/silicon/benchmark_config.json delete mode 100644 frameworks/C++/silicon/build/symbols.hh delete mode 100644 frameworks/C++/silicon/build/techempower.hh delete mode 100644 frameworks/C++/silicon/build/techempower_lwan.cc delete mode 100644 frameworks/C++/silicon/build/techempower_microhttpd.cc delete mode 100644 frameworks/C++/silicon/config.toml delete mode 100644 frameworks/C++/silicon/silicon.dockerfile diff --git a/frameworks/C++/silicon/CMakeLists.txt b/frameworks/C++/silicon/CMakeLists.txt deleted file mode 100644 index 54ea5b6ee8e..00000000000 --- a/frameworks/C++/silicon/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ -cmake_minimum_required(VERSION 2.8) - -project(silicon) - -include_directories(/include $ENV{MICROHTTPD_HOME}/include) - -link_directories(/lib $ENV{MICROHTTPD_HOME}/lib) - -add_definitions(-std=c++14 -ftemplate-depth=1024 -DNDEBUG -O3) - -add_executable(silicon_tpc_mysql techempower_microhttpd.cc) -target_link_libraries(silicon_tpc_mysql microhttpd mysqlclient) - -add_executable(silicon_epoll_mysql techempower_microhttpd.cc) -set_target_properties(silicon_epoll_mysql PROPERTIES COMPILE_FLAGS "-DTFB_USE_EPOLL") -target_link_libraries(silicon_epoll_mysql microhttpd mysqlclient) - -add_executable(silicon_lwan_mysql techempower_lwan.cc) -target_link_libraries(silicon_lwan_mysql mysqlclient lwan ubsan curl z pthread dl luajit-5.1) diff --git a/frameworks/C++/silicon/README.md b/frameworks/C++/silicon/README.md deleted file mode 100644 index 9c4e3badcfa..00000000000 --- a/frameworks/C++/silicon/README.md +++ /dev/null @@ -1,8 +0,0 @@ -# C++/silicon Benchmarking test - -Silicon is a C++ web framework located at https://github.com/matt-42/silicon - -### Note - -The `silicon-epoll-mysql` and `silicon-lwan-mysql` tests are currently not working. They have been removed from the `benchmark_config.json` file but the implementations still exist. You can see the old `benchmark_config.json` [here](https://github.com/TechEmpower/FrameworkBenchmarks/blob/5d44d57cbb5cbc209a2d6aeb23010b466c055200/frameworks/C%2B%2B/silicon/benchmark_config.json). - diff --git a/frameworks/C++/silicon/benchmark_config.json b/frameworks/C++/silicon/benchmark_config.json deleted file mode 100644 index 408a7483ba3..00000000000 --- a/frameworks/C++/silicon/benchmark_config.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "framework": "silicon", - "tests": [{ - "default": { - "json_url" : "/json", - "db_url" : "/db", - "query_url" : "/queries?queries=", - "fortune_url" : "/fortunes", - "update_url" : "/updates?queries=", - "plaintext_url" : "/plaintext", - "port": 8080, - "approach": "Realistic", - "classification": "Micro", - "database": "MySQL", - "framework": "silicon", - "language": "C++", - "flavor": "None", - "orm": "Full", - "platform": "None", - "webserver": "microhttpd", - "os": "Linux", - "database_os": "Linux", - "display_name": "silicon-tpc-mysql", - "notes": "", - "versus": "silicon" - } - }] -} diff --git a/frameworks/C++/silicon/build/symbols.hh b/frameworks/C++/silicon/build/symbols.hh deleted file mode 100644 index 9d973373ac5..00000000000 --- a/frameworks/C++/silicon/build/symbols.hh +++ /dev/null @@ -1,47 +0,0 @@ -// Generated by iod_generate_symbols. -#include -#ifndef IOD_SYMBOL_db -#define IOD_SYMBOL_db - iod_define_symbol(db) -#endif - -#ifndef IOD_SYMBOL_fortunes -#define IOD_SYMBOL_fortunes - iod_define_symbol(fortunes) -#endif - -#ifndef IOD_SYMBOL_id -#define IOD_SYMBOL_id - iod_define_symbol(id) -#endif - -#ifndef IOD_SYMBOL_json -#define IOD_SYMBOL_json - iod_define_symbol(json) -#endif - -#ifndef IOD_SYMBOL_message -#define IOD_SYMBOL_message - iod_define_symbol(message) -#endif - -#ifndef IOD_SYMBOL_plaintext -#define IOD_SYMBOL_plaintext - iod_define_symbol(plaintext) -#endif - -#ifndef IOD_SYMBOL_queries -#define IOD_SYMBOL_queries - iod_define_symbol(queries) -#endif - -#ifndef IOD_SYMBOL_randomNumber -#define IOD_SYMBOL_randomNumber - iod_define_symbol(randomNumber) -#endif - -#ifndef IOD_SYMBOL_updates -#define IOD_SYMBOL_updates - iod_define_symbol(updates) -#endif - diff --git a/frameworks/C++/silicon/build/techempower.hh b/frameworks/C++/silicon/build/techempower.hh deleted file mode 100644 index 3ecbfa1834f..00000000000 --- a/frameworks/C++/silicon/build/techempower.hh +++ /dev/null @@ -1,102 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include "symbols.hh" - -using namespace s; -using namespace sl; - -typedef decltype(D(_id(_auto_increment, _primary_key) = int(), - _randomNumber = int())) random_number; - -typedef decltype(D(_id(_auto_increment, _primary_key) = int(), - _message = std::string())) fortune; - -typedef mysql_orm_factory rn_orm_factory; -typedef mysql_orm rn_orm; - -typedef mysql_orm_factory fortune_orm_factory; -typedef mysql_orm fortune_orm; - - -std::string escape_html_entities(std::string& data) -{ - std::string buffer; - buffer.reserve(data.size()); - for(size_t pos = 0; pos != data.size(); ++pos) { - switch(data[pos]) { - case '&': buffer.append("&"); break; - case '\"': buffer.append("""); break; - case '\'': buffer.append("'"); break; - case '<': buffer.append("<"); break; - case '>': buffer.append(">"); break; - default: buffer.append(&data[pos], 1); break; - } - } - return std::move(buffer); -} - -auto techempower_api = http_api( - - GET / _plaintext = [] () { return response(_content_type = string_ref("text/plain"), - _body = string_ref("Hello, World!")); }, - - GET / _json = [] () { return response(_content_type = string_ref("application/json"), - _body = D(_message = "Hello, World!")); }, - - GET / _db = [] (rn_orm& orm) { - random_number r; - orm.find_by_id(1245, r); - return response(_content_type = "application/json", - _body = r); - }, - - GET / _queries * get_parameters(_queries = optional(std::string("1"))) = [] (auto param, rn_orm& orm) { - int N = atoi(param.queries.c_str()); - N = std::max(1, std::min(N, 500)); - - std::vector qs(N); - for (int i = 0; i < N; i++) - orm.find_by_id(1 + rand() % 9999, qs[i]); - return response(_content_type = "application/json", - _body = std::move(qs)); - }, - - GET / _updates * get_parameters(_queries = optional(std::string("1"))) = [] (auto param, rn_orm& orm) { - int N = atoi(param.queries.c_str()); - N = std::max(1, std::min(N, 500)); - - std::vector qs(N); - for (int i = 0; i < N; i++) - { - orm.find_by_id(1 + rand() % 9999, qs[i]); - qs[i].randomNumber = 1 + rand() % 9999; - orm.update(qs[i]); - } - return response(_content_type = "application/json", - _body = std::move(qs)); - }, - - GET / _fortunes = [] (fortune_orm& orm) { - std::vector table; - orm.forall([&] (fortune& f) { table.push_back(f); }); - table.push_back(fortune(0, "Additional fortune added at request time.")); - - std::sort(table.begin(), table.end(), - [] (const fortune& a, const fortune& b) { return a.message < b.message; }); - - std::stringstream ss; - - ss << "Fortunes"; - for(auto& f : table) - ss << ""; - ss << "
idmessage
" << f.id << "" << escape_html_entities(f.message) << "
"; - - return response(_content_type = "text/html; charset=utf-8", - _body = ss.str()); - } - - ); diff --git a/frameworks/C++/silicon/build/techempower_lwan.cc b/frameworks/C++/silicon/build/techempower_lwan.cc deleted file mode 100644 index 12be2db22f4..00000000000 --- a/frameworks/C++/silicon/build/techempower_lwan.cc +++ /dev/null @@ -1,41 +0,0 @@ -#include - -#include "techempower.hh" - -using namespace s; -using namespace sl; - -int main(int argc, char* argv[]) -{ - if (argc != 3) - { - std::cerr << "Usage: " << argv[0] << " mysql_host port" << std::endl; - return 1; - } - - auto techempower_middlewares = middleware_factories( - mysql_connection_factory(argv[1], "benchmarkdbuser", "benchmarkdbpass", "hello_world"), - fortune_orm_factory("Fortune"), - rn_orm_factory("World") - ); - - try - { - - // Write the pid. - std::ofstream pidfile(argv[3]); - pidfile << getpid() << std::endl; - pidfile.close(); - - // Start the server. - sl::lwan_json_serve(techempower_api, techempower_middlewares, atoi(argv[2])); - } - catch (std::exception& e) - { - std::cerr << e.what() << std::endl; - } - catch (sl::error::error& e) - { - std::cerr << e.what() << std::endl; - } -} diff --git a/frameworks/C++/silicon/build/techempower_microhttpd.cc b/frameworks/C++/silicon/build/techempower_microhttpd.cc deleted file mode 100644 index 984af647f03..00000000000 --- a/frameworks/C++/silicon/build/techempower_microhttpd.cc +++ /dev/null @@ -1,48 +0,0 @@ -#include - -#include "techempower.hh" - -using namespace s; -using namespace sl; - -int main(int argc, char* argv[]) -{ - - if (argc != 4) - { - std::cerr << "Usage: " << argv[0] << " mysql_host port nthreads" << std::endl; - return 1; - } - - auto techempower_middlewares = middleware_factories( - mysql_connection_factory(argv[1], "benchmarkdbuser", "benchmarkdbpass", "hello_world"), - fortune_orm_factory("Fortune"), - rn_orm_factory("World") - ); - - try - { - // Write the pid. - std::ofstream pidfile(argv[3]); - pidfile << getpid() << std::endl; - pidfile.close(); - - // Start the server. - sl::mhd_json_serve(techempower_api, techempower_middlewares, atoi(argv[2]), _blocking -#ifdef TFB_USE_EPOLL - , _linux_epoll, _nthreads = atoi(argv[3]) -#else - , _one_thread_per_connection -#endif - ); - - } - catch (std::exception& e) - { - std::cerr << e.what() << std::endl; - } - catch (sl::error::error& e) - { - std::cerr << e.what() << std::endl; - } -} diff --git a/frameworks/C++/silicon/config.toml b/frameworks/C++/silicon/config.toml deleted file mode 100644 index 745d5778ea8..00000000000 --- a/frameworks/C++/silicon/config.toml +++ /dev/null @@ -1,19 +0,0 @@ -[framework] -name = "silicon" - -[main] -urls.plaintext = "/plaintext" -urls.json = "/json" -urls.db = "/db" -urls.query = "/queries?queries=" -urls.update = "/updates?queries=" -urls.fortune = "/fortunes" -approach = "Realistic" -classification = "Micro" -database = "MySQL" -database_os = "Linux" -os = "Linux" -orm = "Full" -platform = "None" -webserver = "microhttpd" -versus = "silicon" diff --git a/frameworks/C++/silicon/silicon.dockerfile b/frameworks/C++/silicon/silicon.dockerfile deleted file mode 100644 index b7abb7e57c9..00000000000 --- a/frameworks/C++/silicon/silicon.dockerfile +++ /dev/null @@ -1,39 +0,0 @@ -FROM buildpack-deps:xenial - -RUN apt-get update -yqq && apt-get install -yqq software-properties-common cmake apt-transport-https - -RUN add-apt-repository -s "deb http://apt.llvm.org/`lsb_release -cs`/ llvm-toolchain-`lsb_release -cs`-3.9 main" -RUN wget -O - http://apt.llvm.org/llvm-snapshot.gpg.key| apt-key add - -RUN apt-get update -yqq -RUN apt-get install -yqq clang-3.9 lldb-3.9 - -ENV MICROHTTPD_VERSION=0.9.39 -ENV MICROHTTPD=/libmicrohttpd -ENV MICROHTTPD_HOME=$MICROHTTPD-$VERSION - -RUN wget http://mirror.ibcp.fr/pub/gnu/libmicrohttpd/libmicrohttpd-$MICROHTTPD_VERSION.tar.gz -RUN tar xf libmicrohttpd-$MICROHTTPD_VERSION.tar.gz -RUN cd libmicrohttpd-$MICROHTTPD_VERSION && \ - ./configure --prefix=$MICROHTTPD_HOME && \ - make install - -ENV PATH=${MICROHTTPD_HOME}/bin:${PATH} - -RUN apt-get install -yqq libboost-dev cmake - -ENV SILICON=/silicon - -COPY ./ ./ - -RUN git clone https://github.com/matt-42/silicon.git && \ - cd silicon && \ - git checkout ecaf04887c9dbbf0f457afab1f487268f6aeffab && \ - CC=clang-3.9 CXX=clang++-3.9 ./install.sh / - -RUN cd build && \ - cmake .. -DCMAKE_CXX_COMPILER=clang++-3.9 && \ - make silicon_tpc_mysql - -EXPOSE 8080 - -CMD /build/silicon_tpc_mysql tfb-database 8080 $(nproc) From de5eec3bb59bde2e713460006dc940bd24726d45 Mon Sep 17 00:00:00 2001 From: Petrik de Heus Date: Fri, 7 Jun 2024 23:53:47 +0200 Subject: [PATCH 15/45] [ruby/grape] Update dependencies (#9094) --- frameworks/Ruby/grape/Gemfile | 10 ++++------ frameworks/Ruby/grape/README.md | 5 ++--- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/frameworks/Ruby/grape/Gemfile b/frameworks/Ruby/grape/Gemfile index 11003918d94..185a55f68e2 100644 --- a/frameworks/Ruby/grape/Gemfile +++ b/frameworks/Ruby/grape/Gemfile @@ -1,11 +1,9 @@ source 'https://rubygems.org' -gem 'mysql2', '0.5.4' +gem 'mysql2', '0.5.6' gem 'unicorn', '6.1.0' -gem 'puma', '5.6.4' -gem 'activerecord', '7.0.3', :require => 'active_record' -gem 'activerecord-import', '1.4.0' -gem 'grape', '1.6.2' -gem 'rack', '2.2.3.1' +gem 'puma', '~> 6.4' +gem 'activerecord', '~> 7.1.0', :require => 'active_record' +gem 'grape', '2.0.0' gem 'multi_json', require: 'multi_json' gem 'oj', '~> 3.16' diff --git a/frameworks/Ruby/grape/README.md b/frameworks/Ruby/grape/README.md index 80bb63763a4..6e35abfae04 100644 --- a/frameworks/Ruby/grape/README.md +++ b/frameworks/Ruby/grape/README.md @@ -12,10 +12,9 @@ comparing a variety of web servers. The tests were run with: * [Ruby 3.3](http://www.ruby-lang.org/) -* [Grape 1.6.2](http://www.ruby-grape.org/) -* [Rack 2.2.3.1](https://rack.github.io/) +* [Grape 2.0.0](http://www.ruby-grape.org/) * [Unicorn 6.1.0](https://yhbt.net/unicorn/) -* [Puma 5.6.4](https://puma.io/) +* [Puma 6.4](https://puma.io/) ## Paths & Source for Tests From c0a0aa9562e115d054abde0634e256ea90005bfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20N=C3=A4geli?= Date: Fri, 7 Jun 2024 23:54:20 +0200 Subject: [PATCH 16/45] Update GenHTTP to version 8.5 (#9090) * Update GenHTTP to version 8.5 * Update server to 8.5.2 --- .../CSharp/genhttp/Benchmarks/Benchmarks.csproj | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/frameworks/CSharp/genhttp/Benchmarks/Benchmarks.csproj b/frameworks/CSharp/genhttp/Benchmarks/Benchmarks.csproj index b00a3994898..9b49099c3bb 100644 --- a/frameworks/CSharp/genhttp/Benchmarks/Benchmarks.csproj +++ b/frameworks/CSharp/genhttp/Benchmarks/Benchmarks.csproj @@ -28,13 +28,13 @@ - - - + + + - - + + - \ No newline at end of file + From e50dde3cddd740c5e04c6e9bb1ec8685bfb865d0 Mon Sep 17 00:00:00 2001 From: Jonas Konrad Date: Sat, 8 Jun 2024 00:02:11 +0200 Subject: [PATCH 17/45] Disable testresources and downgrade docker images (#9084) This is an attempt to fix the JIT-only regression introduced by f2b0b607acb50c71890f00693bc2f467d217ba4f . --- .../Java/micronaut/micronaut-data-jdbc-graalvm.dockerfile | 2 +- frameworks/Java/micronaut/micronaut-data-jdbc.dockerfile | 6 +++--- .../micronaut/micronaut-data-mongodb-graalvm.dockerfile | 2 +- frameworks/Java/micronaut/micronaut-data-mongodb.dockerfile | 6 +++--- .../Java/micronaut/micronaut-data-r2dbc-graalvm.dockerfile | 2 +- frameworks/Java/micronaut/micronaut-data-r2dbc.dockerfile | 6 +++--- frameworks/Java/micronaut/micronaut-graalvm.dockerfile | 2 +- frameworks/Java/micronaut/micronaut-jdbc-graalvm.dockerfile | 2 +- frameworks/Java/micronaut/micronaut-jdbc.dockerfile | 6 +++--- frameworks/Java/micronaut/micronaut-r2dbc.dockerfile | 6 +++--- frameworks/Java/micronaut/micronaut.dockerfile | 6 +++--- 11 files changed, 23 insertions(+), 23 deletions(-) diff --git a/frameworks/Java/micronaut/micronaut-data-jdbc-graalvm.dockerfile b/frameworks/Java/micronaut/micronaut-data-jdbc-graalvm.dockerfile index c93c4012437..63eb26907b0 100644 --- a/frameworks/Java/micronaut/micronaut-data-jdbc-graalvm.dockerfile +++ b/frameworks/Java/micronaut/micronaut-data-jdbc-graalvm.dockerfile @@ -2,7 +2,7 @@ FROM ghcr.io/graalvm/native-image-community:21-ol9 as build RUN microdnf install findutils # Gradle 8.7 requires xargs COPY . /home/gradle/src WORKDIR /home/gradle/src -RUN ./gradlew micronaut-data-jdbc:nativeCompile -x test --no-daemon +RUN ./gradlew micronaut-data-jdbc:nativeCompile -x test -x internalStartTestResourcesService --no-daemon FROM cgr.dev/chainguard/wolfi-base:latest WORKDIR /micronaut diff --git a/frameworks/Java/micronaut/micronaut-data-jdbc.dockerfile b/frameworks/Java/micronaut/micronaut-data-jdbc.dockerfile index 53b8546389f..60c935c6d25 100644 --- a/frameworks/Java/micronaut/micronaut-data-jdbc.dockerfile +++ b/frameworks/Java/micronaut/micronaut-data-jdbc.dockerfile @@ -1,9 +1,9 @@ -FROM gradle:8.7.0-jdk21 as build +FROM gradle:8.7.0-jdk17 as build COPY --chown=gradle:gradle . /home/gradle/src WORKDIR /home/gradle/src -RUN gradle micronaut-data-jdbc:build -x test --no-daemon +RUN gradle micronaut-data-jdbc:build -x test -x internalStartTestResourcesService --no-daemon -FROM openjdk:22 +FROM openjdk:21 WORKDIR /micronaut COPY --from=build /home/gradle/src/micronaut-data-jdbc/build/libs/micronaut-data-jdbc-all.jar micronaut.jar COPY run_benchmark.sh run_benchmark.sh diff --git a/frameworks/Java/micronaut/micronaut-data-mongodb-graalvm.dockerfile b/frameworks/Java/micronaut/micronaut-data-mongodb-graalvm.dockerfile index 162ab11cb31..85472860d78 100644 --- a/frameworks/Java/micronaut/micronaut-data-mongodb-graalvm.dockerfile +++ b/frameworks/Java/micronaut/micronaut-data-mongodb-graalvm.dockerfile @@ -2,7 +2,7 @@ FROM ghcr.io/graalvm/native-image-community:21-ol9 as build RUN microdnf install findutils # Gradle 8.7 requires xargs COPY . /home/gradle/src WORKDIR /home/gradle/src -RUN ./gradlew micronaut-data-mongodb:nativeCompile -x test --no-daemon +RUN ./gradlew micronaut-data-mongodb:nativeCompile -x test -x internalStartTestResourcesService --no-daemon FROM cgr.dev/chainguard/wolfi-base:latest WORKDIR /micronaut diff --git a/frameworks/Java/micronaut/micronaut-data-mongodb.dockerfile b/frameworks/Java/micronaut/micronaut-data-mongodb.dockerfile index 4e8c3f928f7..f098cf335eb 100644 --- a/frameworks/Java/micronaut/micronaut-data-mongodb.dockerfile +++ b/frameworks/Java/micronaut/micronaut-data-mongodb.dockerfile @@ -1,9 +1,9 @@ -FROM gradle:8.7.0-jdk21 as build +FROM gradle:8.7.0-jdk17 as build COPY --chown=gradle:gradle . /home/gradle/src WORKDIR /home/gradle/src -RUN gradle micronaut-data-mongodb:build -x test --no-daemon +RUN gradle micronaut-data-mongodb:build -x test -x internalStartTestResourcesService --no-daemon -FROM openjdk:22 +FROM openjdk:21 WORKDIR /micronaut COPY --from=build /home/gradle/src/micronaut-data-mongodb/build/libs/micronaut-data-mongodb-all.jar micronaut.jar COPY run_benchmark.sh run_benchmark.sh diff --git a/frameworks/Java/micronaut/micronaut-data-r2dbc-graalvm.dockerfile b/frameworks/Java/micronaut/micronaut-data-r2dbc-graalvm.dockerfile index 14004898dc1..6ada77518a5 100644 --- a/frameworks/Java/micronaut/micronaut-data-r2dbc-graalvm.dockerfile +++ b/frameworks/Java/micronaut/micronaut-data-r2dbc-graalvm.dockerfile @@ -2,7 +2,7 @@ FROM ghcr.io/graalvm/native-image-community:21-ol9 as build RUN microdnf install findutils # Gradle 8.7 requires xargs COPY . /home/gradle/src WORKDIR /home/gradle/src -RUN ./gradlew micronaut-data-r2dbc:nativeCompile -x test --no-daemon +RUN ./gradlew micronaut-data-r2dbc:nativeCompile -x test -x internalStartTestResourcesService --no-daemon FROM cgr.dev/chainguard/wolfi-base:latest WORKDIR /micronaut diff --git a/frameworks/Java/micronaut/micronaut-data-r2dbc.dockerfile b/frameworks/Java/micronaut/micronaut-data-r2dbc.dockerfile index 04f065d8288..0fe88905ef3 100644 --- a/frameworks/Java/micronaut/micronaut-data-r2dbc.dockerfile +++ b/frameworks/Java/micronaut/micronaut-data-r2dbc.dockerfile @@ -1,9 +1,9 @@ -FROM gradle:8.7.0-jdk21 as build +FROM gradle:8.7.0-jdk17 as build COPY --chown=gradle:gradle . /home/gradle/src WORKDIR /home/gradle/src -RUN gradle micronaut-data-r2dbc:build -x test --no-daemon +RUN gradle micronaut-data-r2dbc:build -x test -x internalStartTestResourcesService --no-daemon -FROM openjdk:22 +FROM openjdk:21 WORKDIR /micronaut COPY --from=build /home/gradle/src/micronaut-data-r2dbc/build/libs/micronaut-data-r2dbc-all.jar micronaut.jar COPY run_benchmark.sh run_benchmark.sh diff --git a/frameworks/Java/micronaut/micronaut-graalvm.dockerfile b/frameworks/Java/micronaut/micronaut-graalvm.dockerfile index f4cbb033460..6a9208967cc 100644 --- a/frameworks/Java/micronaut/micronaut-graalvm.dockerfile +++ b/frameworks/Java/micronaut/micronaut-graalvm.dockerfile @@ -2,7 +2,7 @@ FROM ghcr.io/graalvm/native-image-community:21-ol9 as build RUN microdnf install findutils # Gradle 8.7 requires xargs COPY . /home/gradle/src WORKDIR /home/gradle/src -RUN ./gradlew micronaut-vertx-pg-client:nativeCompile -x test --no-daemon +RUN ./gradlew micronaut-vertx-pg-client:nativeCompile -x test -x internalStartTestResourcesService --no-daemon FROM cgr.dev/chainguard/wolfi-base:latest RUN apk --no-cache update && apk add libstdc++ diff --git a/frameworks/Java/micronaut/micronaut-jdbc-graalvm.dockerfile b/frameworks/Java/micronaut/micronaut-jdbc-graalvm.dockerfile index a64b60773ad..27cb088bb04 100644 --- a/frameworks/Java/micronaut/micronaut-jdbc-graalvm.dockerfile +++ b/frameworks/Java/micronaut/micronaut-jdbc-graalvm.dockerfile @@ -2,7 +2,7 @@ FROM ghcr.io/graalvm/native-image-community:21-ol9 as build RUN microdnf install findutils # Gradle 8.7 requires xargs COPY . /home/gradle/src WORKDIR /home/gradle/src -RUN ./gradlew micronaut-jdbc:nativeCompile -x test --no-daemon +RUN ./gradlew micronaut-jdbc:nativeCompile -x test -x internalStartTestResourcesService --no-daemon FROM cgr.dev/chainguard/wolfi-base:latest WORKDIR /micronaut diff --git a/frameworks/Java/micronaut/micronaut-jdbc.dockerfile b/frameworks/Java/micronaut/micronaut-jdbc.dockerfile index 1d56f8a5a8a..63b613d4e61 100644 --- a/frameworks/Java/micronaut/micronaut-jdbc.dockerfile +++ b/frameworks/Java/micronaut/micronaut-jdbc.dockerfile @@ -1,9 +1,9 @@ -FROM gradle:8.7.0-jdk21 as build +FROM gradle:8.7.0-jdk17 as build COPY --chown=gradle:gradle . /home/gradle/src WORKDIR /home/gradle/src -RUN gradle micronaut-jdbc:build -x test --no-daemon +RUN gradle micronaut-jdbc:build -x test -x internalStartTestResourcesService --no-daemon -FROM openjdk:22 +FROM openjdk:21 WORKDIR /micronaut COPY --from=build /home/gradle/src/micronaut-jdbc/build/libs/micronaut-jdbc-all.jar micronaut.jar COPY run_benchmark.sh run_benchmark.sh diff --git a/frameworks/Java/micronaut/micronaut-r2dbc.dockerfile b/frameworks/Java/micronaut/micronaut-r2dbc.dockerfile index 7bc182aa09c..480b47cffa2 100644 --- a/frameworks/Java/micronaut/micronaut-r2dbc.dockerfile +++ b/frameworks/Java/micronaut/micronaut-r2dbc.dockerfile @@ -1,9 +1,9 @@ -FROM gradle:8.7.0-jdk21 as build +FROM gradle:8.7.0-jdk17 as build COPY --chown=gradle:gradle . /home/gradle/src WORKDIR /home/gradle/src -RUN gradle micronaut-r2dbc:build -x test --no-daemon +RUN gradle micronaut-r2dbc:build -x test -x internalStartTestResourcesService --no-daemon -FROM openjdk:22 +FROM openjdk:21 WORKDIR /micronaut COPY --from=build /home/gradle/src/micronaut-r2dbc/build/libs/micronaut-r2dbc-all.jar micronaut.jar COPY run_benchmark.sh run_benchmark.sh diff --git a/frameworks/Java/micronaut/micronaut.dockerfile b/frameworks/Java/micronaut/micronaut.dockerfile index ce7ff654f4b..5672b1c6ff4 100644 --- a/frameworks/Java/micronaut/micronaut.dockerfile +++ b/frameworks/Java/micronaut/micronaut.dockerfile @@ -1,9 +1,9 @@ -FROM gradle:8.7.0-jdk21 as build +FROM gradle:8.7.0-jdk17 as build COPY --chown=gradle:gradle . /home/gradle/src WORKDIR /home/gradle/src -RUN gradle micronaut-vertx-pg-client:build -x test --no-daemon +RUN gradle micronaut-vertx-pg-client:build -x test -x internalStartTestResourcesService --no-daemon -FROM openjdk:22 +FROM openjdk:21 WORKDIR /micronaut COPY --from=build /home/gradle/src/micronaut-vertx-pg-client/build/libs/micronaut-vertx-pg-client-all.jar micronaut.jar COPY run_benchmark.sh run_benchmark.sh From 84b9953abc68e1b689cc4632e61145c08e8cc266 Mon Sep 17 00:00:00 2001 From: pavelmash <7467039+pavelmash@users.noreply.github.com> Date: Sat, 8 Jun 2024 01:02:27 +0300 Subject: [PATCH 18/45] [mORMot] - migrate to Ubuntu24.04; mORMot@2.2.7579; return to glibc MM (#9072) * [mORMot] - migrate to Ubuntu24.04; mORMot@2.2.7565; return to glibc MM * [mORMot] - mORmot@2.2.7579 + Define FPC_LIBCMM_NOMSIZE to disable the malloc_usable_size() call on Linux + O3 optimization level --------- Co-authored-by: pavel.mash --- frameworks/Pascal/mormot/benchmark_config.json | 2 +- frameworks/Pascal/mormot/mormot.dockerfile | 4 +--- frameworks/Pascal/mormot/setup_and_build.sh | 6 +++--- frameworks/Pascal/mormot/src/raw.pas | 3 +-- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/frameworks/Pascal/mormot/benchmark_config.json b/frameworks/Pascal/mormot/benchmark_config.json index 4a7322cac5f..def2b2c2b17 100644 --- a/frameworks/Pascal/mormot/benchmark_config.json +++ b/frameworks/Pascal/mormot/benchmark_config.json @@ -9,8 +9,8 @@ "query_url": "/queries?queries=", "fortune_url": "/fortunes", "update_url": "/updates?queries=", - "plaintext_url": "/plaintext", "cached_query_url": "/cached-queries?count=", + "plaintext_url": "/plaintext", "port": 8080, "approach": "Realistic", "classification": "Fullstack", diff --git a/frameworks/Pascal/mormot/mormot.dockerfile b/frameworks/Pascal/mormot/mormot.dockerfile index ab276d4cf51..cdb55defb26 100644 --- a/frameworks/Pascal/mormot/mormot.dockerfile +++ b/frameworks/Pascal/mormot/mormot.dockerfile @@ -9,8 +9,7 @@ COPY setup_and_build.sh . RUN /bin/bash -c ./setup_and_build.sh -FROM ubuntu:22.04 -RUN apt-get update -yqq && apt-get install -yqq libmimalloc2.0 +FROM ubuntu:24.04 ARG TFB_TEST_NAME @@ -18,7 +17,6 @@ COPY --from=builder /build/bin/fpc-x86_64-linux/raw /usr/local/bin/raw COPY --from=builder /build/libpq.so.5.16 /usr/lib/x86_64-linux-gnu/libpq.so.5 ENV TFB_TEST_NAME=$TFB_TEST_NAME -ENV LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libmimalloc.so.2.0 EXPOSE 8080 CMD ["raw"] diff --git a/frameworks/Pascal/mormot/setup_and_build.sh b/frameworks/Pascal/mormot/setup_and_build.sh index 7494c84747a..85863798754 100755 --- a/frameworks/Pascal/mormot/setup_and_build.sh +++ b/frameworks/Pascal/mormot/setup_and_build.sh @@ -35,7 +35,7 @@ echo "Download statics from $URL ..." wget -qO- "$URL" | tar -xz -C ./libs/mORMot/static # uncomment for fixed commit URL -URL=https://github.com/synopse/mORMot2/tarball/527b3fb11cb4dad5f2c03ace293b550f85504420 +URL=https://github.com/synopse/mORMot2/tarball/f0fc66c954cd45f5c581e52c21170923805a683b #URL="https://api.github.com/repos/synopse/mORMot2/tarball/$USED_TAG" echo "Download and unpacking mORMot sources from $URL ..." wget -qO- "$URL" | tar -xz -C ./libs/mORMot --strip-components=1 @@ -72,7 +72,7 @@ fi # Warning: (5090) Variable XXX of a managed type does not seem to be initialized SUPRESS_WARN=-vm11047,6058,5092,5091,5060,5058,5057,5028,5024,5023,4081,4079,4055,3187,3124,3123,5059,5036,5089,5090 echo "Start compiling..." -fpc -MDelphi -Sci -Ci -O4 -g -gl -gw2 -Xg -k'-rpath=$ORIGIN' -k-L$BIN \ +fpc -MDelphi -Sci -Ci -O3 -g -gl -gw2 -Xg -k'-rpath=$ORIGIN' -k-L$BIN \ -T$TARGET -P$ARCH \ -veiq -v-n-h- $SUPRESS_WARN \ -Fi"$BIN/fpc-$ARCH_TG/.dcu" -Fi"$MSRC" \ @@ -80,7 +80,7 @@ fpc -MDelphi -Sci -Ci -O4 -g -gl -gw2 -Xg -k'-rpath=$ORIGIN' -k-L$BIN \ -Fu"$MSRC/core" -Fu"$MSRC/db" -Fu"$MSRC/rest" -Fu"$MSRC/crypt" \ -Fu"$MSRC/app" -Fu"$MSRC/net" -Fu"$MSRC/lib" -Fu"$MSRC/orm" -Fu"$MSRC/soa" \ -FU"$BIN/fpc-$ARCH_TG/.dcu" -FE"$BIN/fpc-$ARCH_TG" -o"$BIN/fpc-$ARCH_TG/$dest_fn" \ - -dFPC_LIBCMM \ + -dFPC_LIBCMM -dFPC_LIBCMM_NOMSIZE \ -B -Se1 "./src/raw.pas" | grep "[Warning|Error|Fatal]:" script_successful \ No newline at end of file diff --git a/frameworks/Pascal/mormot/src/raw.pas b/frameworks/Pascal/mormot/src/raw.pas index 27ec81b92f7..fa53c7fd038 100644 --- a/frameworks/Pascal/mormot/src/raw.pas +++ b/frameworks/Pascal/mormot/src/raw.pas @@ -831,8 +831,7 @@ procedure TAsyncWorld.OnRes(Statement: TSqlDBPostgresAsyncStatement; ConsoleWaitForEnterKey; //TSynLog.Family.Level := LOG_VERBOSE; // enable shutdown logs for debug if servers = 1 then - writeln(ObjectToJsonDebug(rawServers[0].fHttpServer, - [woDontStoreVoid, woHumanReadable])) + writeln(ObjectToJsonDebug(rawServers[0].fHttpServer)) else begin writeln('Per-server accepted connections:'); From 3f72bd5545f2451ddf85f0abcacfbaad0a73d121 Mon Sep 17 00:00:00 2001 From: Vladimir Shchur Date: Fri, 7 Jun 2024 15:02:43 -0700 Subject: [PATCH 19/45] [F#/Oxpecker] Got rid of SpanJson as bringning no benefit. Disabled ReadyToRun (#9071) --- frameworks/FSharp/oxpecker/README.md | 1 - .../FSharp/oxpecker/oxpecker.dockerfile | 3 ++ frameworks/FSharp/oxpecker/src/App/App.fsproj | 1 - frameworks/FSharp/oxpecker/src/App/Program.fs | 37 ++++--------------- 4 files changed, 10 insertions(+), 32 deletions(-) diff --git a/frameworks/FSharp/oxpecker/README.md b/frameworks/FSharp/oxpecker/README.md index 4f686292d12..ecd2284661d 100644 --- a/frameworks/FSharp/oxpecker/README.md +++ b/frameworks/FSharp/oxpecker/README.md @@ -19,7 +19,6 @@ This includes tests for plaintext, json, and fortunes HTML serialization. * [Oxpecker](https://github.com/Lanayx/Oxpecker) * [Dapper](https://github.com/DapperLib/Dapper) -* [SpanJson](https://github.com/Tornhoof/SpanJson) * ASP.NET Core ## Paths & Source for Tests diff --git a/frameworks/FSharp/oxpecker/oxpecker.dockerfile b/frameworks/FSharp/oxpecker/oxpecker.dockerfile index c65349e32cd..35a8c509c96 100644 --- a/frameworks/FSharp/oxpecker/oxpecker.dockerfile +++ b/frameworks/FSharp/oxpecker/oxpecker.dockerfile @@ -4,6 +4,9 @@ COPY src/App . RUN dotnet publish -c Release -o out FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime + +ENV DOTNET_ReadyToRun 0 + ENV URLS http://+:8080 WORKDIR /app diff --git a/frameworks/FSharp/oxpecker/src/App/App.fsproj b/frameworks/FSharp/oxpecker/src/App/App.fsproj index 8dca02be01a..a9e0ad2c0ba 100644 --- a/frameworks/FSharp/oxpecker/src/App/App.fsproj +++ b/frameworks/FSharp/oxpecker/src/App/App.fsproj @@ -14,6 +14,5 @@ - \ No newline at end of file diff --git a/frameworks/FSharp/oxpecker/src/App/Program.fs b/frameworks/FSharp/oxpecker/src/App/Program.fs index e0c3f361286..944e0518155 100644 --- a/frameworks/FSharp/oxpecker/src/App/Program.fs +++ b/frameworks/FSharp/oxpecker/src/App/Program.fs @@ -2,7 +2,6 @@ namespace App open System open System.Collections.Generic -open System.Threading.Tasks open Oxpecker [] @@ -60,6 +59,7 @@ module HttpHandlers = open Npgsql open System.Text open Microsoft.AspNetCore.Http + open System.Text.Json let private extra = { @@ -169,48 +169,26 @@ module HttpHandlers = ctx.SetContentType("text/plain") ctx.WriteBytes(result) + let jsonSimple value : EndpointHandler = + let options = JsonSerializerOptions(JsonSerializerDefaults.Web) + fun ctx -> + ctx.Response.WriteAsJsonAsync(value, options) + let endpoints = [| route "/plaintext" <| utf8Const "Hello, World!" - route "/json"<| jsonChunked {| message = "Hello, World!" |} + route "/json"<| jsonSimple {| message = "Hello, World!" |} route "/fortunes" fortunes route "/db" singleQuery route "/queries/{count?}" multipleQueries route "/updates/{count?}" multipleUpdates |] - module Main = - open SpanJson - open Microsoft.AspNetCore.Http open Microsoft.AspNetCore.Builder - open Microsoft.AspNetCore.Hosting open Microsoft.Extensions.DependencyInjection open Microsoft.Extensions.Hosting open Microsoft.Extensions.Logging - open System.Buffers - - type SpanJsonSerializer() = - interface Serializers.IJsonSerializer with - member this.Serialize(value, ctx, chunked) = - ctx.Response.ContentType <- "application/json" - if chunked then - if ctx.Request.Method <> HttpMethods.Head then - JsonSerializer.Generic.Utf8.SerializeAsync<_>(value, stream = ctx.Response.Body).AsTask() - else - Task.CompletedTask - else - task { - let buffer = JsonSerializer.Generic.Utf8.SerializeToArrayPool<_>(value) - ctx.Response.Headers.ContentLength <- buffer.Count - if ctx.Request.Method <> HttpMethods.Head then - do! ctx.Response.Body.WriteAsync(buffer) - ArrayPool.Shared.Return(buffer.Array) - else - return () - } - member this.Deserialize _ = - failwith "Not implemented" [] let main args = @@ -218,7 +196,6 @@ module Main = builder.Services .AddRouting() .AddOxpecker() - .AddSingleton(SpanJsonSerializer()) |> ignore builder.Logging.ClearProviders() |> ignore let app = builder.Build() From 1e7c4e86e3d670a71975052af5d06d746edcc75e Mon Sep 17 00:00:00 2001 From: Henry Date: Sat, 8 Jun 2024 06:02:57 +0800 Subject: [PATCH 20/45] update beetlex to beetlex.light (#9095) * update beetleX to BeetleX.Light * update beetlex to beetlex.light * fix fortunes error * fix error * remove beetlex-core-updb * update * update benchmark_config * update * update * update --- frameworks/CSharp/beetlex/Benchmarks.sln | 6 +- .../beetlex/Benchmarks/Benchmarks.csproj | 5 +- .../CSharp/beetlex/Benchmarks/Program.cs | 9 +- .../beetlex/PlatformBenchmarks/DBRaw.cs | 5 +- .../beetlex/PlatformBenchmarks/GMTDate.cs | 5 +- .../PlatformBenchmarks/HttpHandler.Caching.cs | 41 +- .../beetlex/PlatformBenchmarks/HttpHandler.cs | 352 ++++++++++-------- .../PlatformBenchmarks/HttpHandler.db.cs | 34 +- .../PlatformBenchmarks/HttpHandler.default.cs | 24 +- .../HttpHandler.fortunes.cs | 85 ++--- .../PlatformBenchmarks/HttpHandler.json.cs | 34 +- .../HttpHandler.plaintext.cs | 8 +- .../PlatformBenchmarks/HttpHandler.queries.cs | 45 ++- .../PlatformBenchmarks/HttpHandler.updates.cs | 25 +- .../beetlex/PlatformBenchmarks/HttpServer.cs | 40 +- .../beetlex/PlatformBenchmarks/HttpToken.cs | 114 +++--- .../PlatformBenchmarks/NetApplication.cs | 19 + .../PlatformBenchmarks.csproj | 12 +- .../beetlex/PlatformBenchmarks/Program.cs | 6 + .../beetlex/PlatformBenchmarks/RequestData.cs | 17 +- .../beetlex/beetlex-core-updb.dockerfile | 12 - .../CSharp/beetlex/beetlex-core.dockerfile | 4 +- frameworks/CSharp/beetlex/beetlex.dockerfile | 4 +- .../CSharp/beetlex/benchmark_config.json | 19 - frameworks/CSharp/beetlex/config.toml | 12 - 25 files changed, 491 insertions(+), 446 deletions(-) create mode 100644 frameworks/CSharp/beetlex/PlatformBenchmarks/NetApplication.cs delete mode 100644 frameworks/CSharp/beetlex/beetlex-core-updb.dockerfile diff --git a/frameworks/CSharp/beetlex/Benchmarks.sln b/frameworks/CSharp/beetlex/Benchmarks.sln index 07298d57325..3922903f0b2 100644 --- a/frameworks/CSharp/beetlex/Benchmarks.sln +++ b/frameworks/CSharp/beetlex/Benchmarks.sln @@ -1,11 +1,11 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.28010.2036 +# Visual Studio Version 17 +VisualStudioVersion = 17.9.34728.123 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Benchmarks", "Benchmarks\Benchmarks.csproj", "{12CA0190-5EA2-460F-ABC4-FAD454148EBF}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PlatformBenchmarks", "PlatformBenchmarks\PlatformBenchmarks.csproj", "{8ACF83AD-E861-4642-BEF3-A6211F99389D}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PlatformBenchmarks", "PlatformBenchmarks\PlatformBenchmarks.csproj", "{8ACF83AD-E861-4642-BEF3-A6211F99389D}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/frameworks/CSharp/beetlex/Benchmarks/Benchmarks.csproj b/frameworks/CSharp/beetlex/Benchmarks/Benchmarks.csproj index 01cb00297fd..2ae062718ff 100644 --- a/frameworks/CSharp/beetlex/Benchmarks/Benchmarks.csproj +++ b/frameworks/CSharp/beetlex/Benchmarks/Benchmarks.csproj @@ -2,13 +2,12 @@ Exe - net5.0 + net8.0 true - - + diff --git a/frameworks/CSharp/beetlex/Benchmarks/Program.cs b/frameworks/CSharp/beetlex/Benchmarks/Program.cs index 05ba5ed2db8..30f02f76908 100644 --- a/frameworks/CSharp/beetlex/Benchmarks/Program.cs +++ b/frameworks/CSharp/beetlex/Benchmarks/Program.cs @@ -6,9 +6,9 @@ using System.Threading; using System.Text; using BeetleX.Buffers; -using SpanJson; using System.Collections.Generic; using BeetleX.EventArgs; +using System.Text.Json; namespace Benchmarks { @@ -109,8 +109,8 @@ public async virtual Task StartAsync(CancellationToken cancellationToken) mComplete.TrySetResult(new object()); }; mApiServer.Open(); - RawDb._connectionString = "Server=tfb-database;Database=hello_world;User Id=benchmarkdbuser;Password=benchmarkdbpass;Maximum Pool Size=256;NoResetOnClose=true;Enlist=false;Max Auto Prepare=4;Multiplexing=true;Write Coalescing Delay Us=500;Write Coalescing Buffer Threshold Bytes=1000"; - //RawDb._connectionString = "Server=192.168.2.19;Database=hello_world;User Id=benchmarkdbuser;Password=benchmarkdbpass;Maximum Pool Size=256;NoResetOnClose=true;Enlist=false;Max Auto Prepare=3"; + RawDb._connectionString = "Server=tfb-database;Database=hello_world;User Id=benchmarkdbuser;Password=benchmarkdbpass;SSL Mode=Disable;Maximum Pool Size=64;NoResetOnClose=true;Enlist=false;Max Auto Prepare=4;Multiplexing=true;Write Coalescing Buffer Threshold Bytes=1000"; + //RawDb._connectionString = "Server=localhost;Database=hello_world;User Id=benchmarkdbuser;Password=benchmarkdbpass;Maximum Pool Size=256;NoResetOnClose=true;Enlist=false;Max Auto Prepare=3"; await mComplete.Task; } @@ -140,7 +140,8 @@ public SpanJsonResult(object data) public override void Write(PipeStream stream, HttpResponse response) { - JsonSerializer.NonGeneric.Utf8.SerializeAsync(Data, stream); + + JsonSerializer.Serialize(stream, Data); ; } diff --git a/frameworks/CSharp/beetlex/PlatformBenchmarks/DBRaw.cs b/frameworks/CSharp/beetlex/PlatformBenchmarks/DBRaw.cs index c1ef0fa4722..ca668243fe7 100644 --- a/frameworks/CSharp/beetlex/PlatformBenchmarks/DBRaw.cs +++ b/frameworks/CSharp/beetlex/PlatformBenchmarks/DBRaw.cs @@ -7,11 +7,11 @@ using System.Runtime.Versioning; using System.Text; using System.Threading.Tasks; -using System.Runtime.InteropServices.ComTypes; -using BeetleX.EventArgs; + using Microsoft.Extensions.Caching.Memory; using Npgsql; + namespace PlatformBenchmarks { public class RawDb @@ -342,7 +342,6 @@ public static void Init() } } mInited = true; - HttpServer.ApiServer.Log(LogType.Info, null, $"Init update commands cached"); return; } } diff --git a/frameworks/CSharp/beetlex/PlatformBenchmarks/GMTDate.cs b/frameworks/CSharp/beetlex/PlatformBenchmarks/GMTDate.cs index ac9266097ba..76e15ce9f7f 100644 --- a/frameworks/CSharp/beetlex/PlatformBenchmarks/GMTDate.cs +++ b/frameworks/CSharp/beetlex/PlatformBenchmarks/GMTDate.cs @@ -1,4 +1,5 @@ -using BeetleX.Buffers; + +using BeetleX.Light.Memory; using System; using System.Collections.Generic; using System.Text; @@ -99,7 +100,7 @@ private ArraySegment GetData() return GetData(DateTime.Now); } - public void Write(PipeStream stream) + public void Write(IStreamWriter stream) { var data = DATE; stream.Write(data.Array, 0, data.Count); diff --git a/frameworks/CSharp/beetlex/PlatformBenchmarks/HttpHandler.Caching.cs b/frameworks/CSharp/beetlex/PlatformBenchmarks/HttpHandler.Caching.cs index 13d89c6fc97..2b2264ea60a 100644 --- a/frameworks/CSharp/beetlex/PlatformBenchmarks/HttpHandler.Caching.cs +++ b/frameworks/CSharp/beetlex/PlatformBenchmarks/HttpHandler.Caching.cs @@ -1,18 +1,18 @@ -using BeetleX; -using BeetleX.Buffers; -using SpanJson; +using BeetleX.Light.Memory; using System; using System.Collections.Generic; +using System.IO; using System.Text; +using System.Text.Json; using System.Threading.Tasks; namespace PlatformBenchmarks { public partial class HttpHandler { - - public async Task caching(string queryString, PipeStream stream, HttpToken token, ISession session) + + public async Task caching(string queryString, IStreamWriter stream) { int count = 1; if (!string.IsNullOrEmpty(queryString)) @@ -30,20 +30,39 @@ public async Task caching(string queryString, PipeStream stream, HttpToken token count = 500; if (count < 1) count = 1; + ContentLengthMemory content = new ContentLengthMemory(); try { - var data = await token.Db.LoadCachedQueries(count); + var data = await _db.LoadCachedQueries(count); stream.Write(_jsonResultPreamble.Data, 0, _jsonResultPreamble.Length); - token.ContentLength = stream.Allocate(HttpHandler._LengthSize); + content.Data = GetContentLengthMemory(stream); GMTDate.Default.Write(stream); - token.ContentPostion = stream.CacheLength; - await JsonSerializer.NonGeneric.Utf8.SerializeAsync(data, stream); + stream.WriteSequenceNetStream.StartWriteLength(); + + var jsonWriter = GetJsonWriter(stream); + using (var unflush = stream.UnFlush()) + { + jsonWriter.WriteStartArray(); + foreach (var item in data) + { + jsonWriter.WriteStartObject(); + jsonWriter.WriteNumber("Id", item.Id); + jsonWriter.WriteNumber("RandomNumber", item.RandomNumber); + jsonWriter.WriteEndObject(); + } + jsonWriter.WriteEndArray(); + jsonWriter.Flush(); + + } } catch (Exception e_) { - stream.Write(e_.Message); + Context.GetLoger(BeetleX.Light.Logs.LogLevel.Error)?.WriteException(Context, "PlatformBenchmarks", "caching", e_); + stream.WriteString(e_.Message); } - OnCompleted(stream, session, token); + var len = stream.WriteSequenceNetStream.EndWriteLength(); + content.Full(len); + } } } diff --git a/frameworks/CSharp/beetlex/PlatformBenchmarks/HttpHandler.cs b/frameworks/CSharp/beetlex/PlatformBenchmarks/HttpHandler.cs index 8e5b65d9c79..e623afdd72b 100644 --- a/frameworks/CSharp/beetlex/PlatformBenchmarks/HttpHandler.cs +++ b/frameworks/CSharp/beetlex/PlatformBenchmarks/HttpHandler.cs @@ -1,15 +1,21 @@ -using BeetleX; -using BeetleX.Buffers; -using BeetleX.EventArgs; -using SpanJson; +using BeetleX.Light; +using BeetleX.Light.Memory; using System; +using System.Buffers; using System.Collections.Generic; +using System.IO; +using System.IO.Pipelines; using System.Text; +using System.Text.Json; using System.Threading.Tasks; namespace PlatformBenchmarks { - public partial class HttpHandler : ServerHandlerBase + + + + + public partial class HttpHandler : SesionBase { private static readonly AsciiString _line = new AsciiString("\r\n"); @@ -45,7 +51,7 @@ public partial class HttpHandler : ServerHandlerBase private static readonly AsciiString _cached_worlds = "/cached-worlds"; - private readonly static uint _jsonPayloadSize = (uint)System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(new JsonMessage { message = "Hello, World!" }, SerializerOptions).Length; + private readonly static uint _jsonPayloadSize = (uint)System.Text.Json.JsonSerializer.SerializeToUtf8Bytes(new JsonMessage { message = "Hello, World!" }).Length; @@ -65,14 +71,12 @@ public partial class HttpHandler : ServerHandlerBase private readonly static AsciiString _jsonResultPreamble = _httpsuccess + _headerContentTypeJson - + _headerServer - + _headerContentLength; + + _headerServer; private readonly static AsciiString _HtmlResultPreamble = _httpsuccess + _headerContentTypeHtml - + _headerServer - + _headerContentLength; + + _headerServer; @@ -83,24 +87,49 @@ public partial class HttpHandler : ServerHandlerBase private static byte _question = 63; - public HttpHandler() + struct ContentLengthMemory + { + public Memory Data { get; set; } + + public void Full(int length) + { + _headerContentLength.Data.CopyTo(Data); + var span = Data.Slice(_headerContentLength.Length).Span; + var len = span.Write(length.ToString(), Encoding.ASCII); + for (int i = len; i < span.Length - 2; i++) + { + span[i] = 32; + } + span[^2] = 13; + span[^1] = 10; + } + } + + + protected Memory GetContentLengthMemory(IStreamWriter writer) { - RequestDispatchs = new BeetleX.Dispatchs.DispatchCenter(OnRequest, Math.Min(Environment.ProcessorCount, 16)); + var result = writer.WriteSequenceNetStream.GetWriteMemory(28); + writer.WriteSequenceNetStream.WriteAdvance(28); + return result; } - private BeetleX.Dispatchs.DispatchCenter RequestDispatchs; + public NetContext Context { get; set; } + + public HttpHandler() + { + } + private Queue _Requests = new Queue(); - public override void Connected(IServer server, ConnectedEventArgs e) + private RawDb _db; + + private RequestData _ReadRequest = null; + public override void Connected(NetContext context) { - base.Connected(server, e); - e.Session.Socket.NoDelay = true; - var token = new HttpToken(); - token.ThreadDispatcher = RequestDispatchs.Next(); - token.Session = e.Session; - token.Db = new RawDb(new ConcurrentRandom(), Npgsql.NpgsqlFactory.Instance); - e.Session.Tag = token; + base.Connected(context); + this.Context = context; + _db = new RawDb(new ConcurrentRandom(), Npgsql.NpgsqlFactory.Instance); ; } private int AnalysisUrl(ReadOnlySpan url) @@ -114,195 +143,216 @@ private int AnalysisUrl(ReadOnlySpan url) } - private void OnRequest(HttpToken token) + public override void Receive(NetContext context, object message) { - if (token.Requests.TryDequeue(out RequestData result)) + var stream = context.Reader.ReadSequenceNetStream; + var reader = stream.GetReadOnlySequence(); + var len = reader.IndexOf(_line); + while (len != null) { - OnStartRequest(result, token.Session, token, token.Session.Stream.ToPipeStream()); - } - } - - public override void SessionReceive(IServer server, SessionReceiveEventArgs e) - { - base.SessionReceive(server, e); - PipeStream pipeStream = e.Session.Stream.ToPipeStream(); - HttpToken token = (HttpToken)e.Session.Tag; - var result = pipeStream.IndexOfLine(); - while (result.End != null) - { - if (result.Length == 2) + var lendata = len.Value; + stream.ReadAdvance(lendata.Length); + if (lendata.Length == 2) { - pipeStream.ReadFree(result.Length); - OnStartRequest(token.CurrentRequest, e.Session, token, pipeStream); + _Requests.Enqueue(_ReadRequest); + _ReadRequest = null; } else { - if (token.CurrentRequest == null) + if (_ReadRequest == null) + { + _ReadRequest = new RequestData(); + } + if (_ReadRequest.Action == null) { - var request = new RequestData(); - byte[] buffer = null; - buffer = new byte[result.Length]; - pipeStream.Read(buffer, 0, result.Length); - request.Data = new ArraySegment(buffer, 0, result.Length); - AnalysisAction(request); - if (request.Action == ActionType.Plaintext) - { - token.CurrentRequest = request; - } - else - { - token.CurrentRequest = request; - pipeStream.ReadFree((int)pipeStream.Length); - OnStartRequest(request, e.Session, token, pipeStream); - return; - } + AnalysisAction(lendata, out var type, out var querystring); + _ReadRequest.Action = type; + _ReadRequest.QueryString = querystring; + } else { - pipeStream.ReadFree(result.Length); + } } - if (pipeStream.Length > 0) - result = pipeStream.IndexOfLine(); - else - break; + reader = stream.GetReadOnlySequence(); + len = reader.IndexOf(_line); + } + if (_Requests.Count > 0) + { + OnStartRequest(context.Writer); } } - private void AnalysisAction(RequestData requestData) + //public override void SessionReceive(IServer server, SessionReceiveEventArgs e) + //{ + // base.SessionReceive(server, e); + // PipeStream pipeStream = e.Session.Stream.ToPipeStream(); + // HttpToken token = (HttpToken)e.Session.Tag; + // var result = pipeStream.IndexOfLine(); + // while (result.End != null) + // { + // if (result.Length == 2) + // { + // pipeStream.ReadFree(result.Length); + // OnStartRequest(token.CurrentRequest, e.Session, token, pipeStream); + // } + // else + // { + // if (token.CurrentRequest == null) + // { + // var request = new RequestData(); + // byte[] buffer = null; + // buffer = new byte[result.Length]; + // pipeStream.Read(buffer, 0, result.Length); + // request.Data = new ArraySegment(buffer, 0, result.Length); + // AnalysisAction(request); + // if (request.Action == ActionType.Plaintext) + // { + // token.CurrentRequest = request; + // } + // else + // { + // token.CurrentRequest = request; + // pipeStream.ReadFree((int)pipeStream.Length); + // OnStartRequest(request, e.Session, token, pipeStream); + // return; + // } + // } + // else + // { + // pipeStream.ReadFree(result.Length); + // } + // } + // if (pipeStream.Length > 0) + // result = pipeStream.IndexOfLine(); + // else + // break; + // } + //} + + private void AnalysisAction(ReadOnlySequence line, out ActionType type, out string queryString) { - var line = _line.AsSpan(); - int len = requestData.Data.Count; - var receiveData = requestData.GetSpan(); - ReadOnlySpan http = line; - ReadOnlySpan method = line; - ReadOnlySpan url = line; - int offset2 = 0; - int count = 0; - for (int i = 0; i < len; i++) - { - if (receiveData[i] == line[0]) - { - http = receiveData.Slice(offset2, i - offset2); - break; - } - else - { - if (receiveData[i] == _Space) - { - if (count != 0) - { - url = receiveData.Slice(offset2, i - offset2); - offset2 = i + 1; - } - else - { - method = receiveData.Slice(offset2, i - offset2); - offset2 = i + 1; - count++; - } - } - } - } - int queryIndex = AnalysisUrl(url); - ReadOnlySpan baseUrl = default; - ReadOnlySpan queryString = default; - if (queryIndex > 0) + type = ActionType.Plaintext; + queryString = default; + var spanIndex = line.PositionOf((byte)32); + var postion = line.GetPosition(1, spanIndex.Value); + line = line.Slice(postion); + spanIndex = line.PositionOf((byte)32); + var url = line.Slice(0, spanIndex.Value); + int baseurlLen = 0; + spanIndex = url.PositionOf((byte)63); + if (spanIndex != null) { - baseUrl = url.Slice(0, queryIndex); - queryString = url.Slice(queryIndex + 1, url.Length - queryIndex - 1); - requestData.QueryString = Encoding.ASCII.GetString(queryString); + baseurlLen = (int)url.Slice(0, spanIndex.Value).Length; + queryString = url.Slice(baseurlLen + 1).ReadString(Encoding.ASCII); } else { - baseUrl = url; + baseurlLen = (int)url.Length; } + + Span baseUrl = stackalloc byte[baseurlLen]; + url.Slice(0, baseurlLen).CopyTo(baseUrl); + if (baseUrl.Length == _path_Plaintext.Length && baseUrl.StartsWith(_path_Plaintext)) { - requestData.Action = ActionType.Plaintext; + type = ActionType.Plaintext; } else if (baseUrl.Length == _path_Json.Length && baseUrl.StartsWith(_path_Json)) { - requestData.Action = ActionType.Json; + type = ActionType.Json; } else if (baseUrl.Length == _path_Db.Length && baseUrl.StartsWith(_path_Db)) { - requestData.Action = ActionType.Db; + type = ActionType.Db; } else if (baseUrl.Length == _path_Queries.Length && baseUrl.StartsWith(_path_Queries)) { - requestData.Action = ActionType.Queries; + type = ActionType.Queries; } else if (baseUrl.Length == _cached_worlds.Length && baseUrl.StartsWith(_cached_worlds)) { - requestData.Action = ActionType.Caching; + type = ActionType.Caching; } else if (baseUrl.Length == _path_Updates.Length && baseUrl.StartsWith(_path_Updates)) { - requestData.Action = ActionType.Updates; + type = ActionType.Updates; } else if (baseUrl.Length == _path_Fortunes.Length && baseUrl.StartsWith(_path_Fortunes)) { - requestData.Action = ActionType.Fortunes; + type = ActionType.Fortunes; } else { - requestData.Action = ActionType.Other; + type = ActionType.Other; } } - public virtual async Task OnStartRequest(RequestData data, ISession session, HttpToken token, PipeStream stream) + public async Task OnStartRequest(IStreamWriter stream) { - ActionType type = data.Action; - if (type == ActionType.Plaintext) - { - await Plaintext(stream, token, session); - } - else if (type == ActionType.Json) - { - await Json(stream, token, session); - } - else if (type == ActionType.Db) - { - await db(stream, token, session); - } - else if (type == ActionType.Queries) - { - await queries(data.QueryString, stream, token, session); - } - else if (type == ActionType.Caching) - { - await caching(data.QueryString, stream, token, session); - } - else if (type == ActionType.Updates) - { - await updates(data.QueryString, stream, token, session); - } - else if (type == ActionType.Fortunes) + bool haveData = false; + while (_Requests.Count > 0) { - await fortunes(stream, token, session); + haveData = true; + var data = _Requests.Dequeue(); + ActionType type = data.Action.Value; + if (type == ActionType.Plaintext) + { + Plaintext(stream); + } + else if (type == ActionType.Json) + { + Json(stream); + } + else if (type == ActionType.Db) + { + await db(stream); + } + else if (type == ActionType.Queries) + { + await queries(data.QueryString, stream); + } + else if (type == ActionType.Caching) + { + await caching(data.QueryString, stream); + } + else if (type == ActionType.Updates) + { + await updates(data.QueryString, stream); + } + else if (type == ActionType.Fortunes) + { + await fortunes(stream); + } + else + { + await Default(stream); + } } - else + if (haveData) { - await Default(stream, token, session); + stream.Flush(); } - } - private void OnCompleted(PipeStream stream, ISession session, HttpToken token) + + + private Utf8JsonWriter GetJsonWriter(IStreamWriter stream) { - var type = token.CurrentRequest.Action; - if (type != ActionType.Plaintext && type != ActionType.Json) - { - token.FullLength((stream.CacheLength - token.ContentPostion).ToString()); - } - if (token.Requests.IsEmpty && stream.Length == 0) - session.Stream.Flush(); - token.CurrentRequest = null; + Utf8JsonWriter utf8JsonWriter = _utf8JsonWriter ??= new Utf8JsonWriter((Stream)stream.WriteSequenceNetStream, new JsonWriterOptions { SkipValidation = true }); + utf8JsonWriter.Reset((Stream)stream.WriteSequenceNetStream); + return utf8JsonWriter; } + [ThreadStatic] + private static Utf8JsonWriter _utf8JsonWriter; + public static JsonWriterOptions _jsonWriterOptions = new JsonWriterOptions + { + SkipValidation = true + }; } } diff --git a/frameworks/CSharp/beetlex/PlatformBenchmarks/HttpHandler.db.cs b/frameworks/CSharp/beetlex/PlatformBenchmarks/HttpHandler.db.cs index a6f6c8f2291..27c71d43f13 100644 --- a/frameworks/CSharp/beetlex/PlatformBenchmarks/HttpHandler.db.cs +++ b/frameworks/CSharp/beetlex/PlatformBenchmarks/HttpHandler.db.cs @@ -1,8 +1,7 @@ -using BeetleX; -using BeetleX.Buffers; -using SpanJson; +using BeetleX.Light.Memory; using System; using System.Collections.Generic; +using System.IO; using System.Text; using System.Threading.Tasks; @@ -12,23 +11,36 @@ public partial class HttpHandler { - public async ValueTask db(PipeStream stream, HttpToken token, ISession session) + public async Task db(IStreamWriter stream) { + ContentLengthMemory content = new ContentLengthMemory(); + try { - var data = await token.Db.LoadSingleQueryRow(); + var data = await _db.LoadSingleQueryRow(); stream.Write(_jsonResultPreamble.Data, 0, _jsonResultPreamble.Length); - token.ContentLength = stream.Allocate(HttpHandler._LengthSize); + content.Data = GetContentLengthMemory(stream); GMTDate.Default.Write(stream); - token.ContentPostion = stream.CacheLength; - System.Text.Json.JsonSerializer.Serialize(GetUtf8JsonWriter(stream, token), data, SerializerOptions); + stream.WriteSequenceNetStream.StartWriteLength(); + var jsonWriter = GetJsonWriter(stream); + using (var unflush = stream.UnFlush()) + { + jsonWriter.WriteStartObject(); + jsonWriter.WriteNumber("Id", data.Id); + jsonWriter.WriteNumber("RandomNumber", data.RandomNumber); + jsonWriter.WriteEndObject(); + System.Text.Json.JsonSerializer.Serialize((Stream)stream.WriteSequenceNetStream, data); + } + } catch (Exception e_) { - HttpServer.ApiServer.Log(BeetleX.EventArgs.LogType.Error, null, $"db error {e_.Message}@{e_.StackTrace}"); - stream.Write(e_.Message); + Context.GetLoger(BeetleX.Light.Logs.LogLevel.Error)?.WriteException(Context, "PlatformBenchmarks", "db", e_); + stream.WriteString(e_.Message); } - OnCompleted(stream, session, token); + var len = stream.WriteSequenceNetStream.EndWriteLength(); + content.Full(len); + } } } diff --git a/frameworks/CSharp/beetlex/PlatformBenchmarks/HttpHandler.default.cs b/frameworks/CSharp/beetlex/PlatformBenchmarks/HttpHandler.default.cs index acbaff5b164..2300e16a4b2 100644 --- a/frameworks/CSharp/beetlex/PlatformBenchmarks/HttpHandler.default.cs +++ b/frameworks/CSharp/beetlex/PlatformBenchmarks/HttpHandler.default.cs @@ -1,6 +1,7 @@ -using BeetleX; -using BeetleX.Buffers; + +using BeetleX.Light.Memory; using System; +using System.Buffers; using System.Collections.Generic; using System.Linq; using System.Text; @@ -15,16 +16,19 @@ public partial class HttpHandler + _headerContentTypeJson.ToString() + _headerServer.ToString(); - public Task Default(PipeStream stream, HttpToken token, ISession session) - { + public ValueTask Default(IStreamWriter stream) + { + stream.Write(_defaultPreamble.Data, 0, _defaultPreamble.Length); - token.ContentLength = stream.Allocate(HttpHandler._LengthSize); + ContentLengthMemory contentLength = new ContentLengthMemory(); + contentLength.Data = GetContentLengthMemory(stream); GMTDate.Default.Write(stream); - token.ContentPostion = stream.CacheLength; - stream.Write(" beetlex server
"); - stream.Write("path not found!"); - OnCompleted(stream, session, token); - return Task.CompletedTask; + stream.WriteSequenceNetStream.StartWriteLength(); + stream.WriteString(" beetlex server
"); + stream.WriteString("path not found!"); + var length = stream.WriteSequenceNetStream.EndWriteLength(); + contentLength.Full(length); + return ValueTask.CompletedTask; } } } diff --git a/frameworks/CSharp/beetlex/PlatformBenchmarks/HttpHandler.fortunes.cs b/frameworks/CSharp/beetlex/PlatformBenchmarks/HttpHandler.fortunes.cs index 55250710b35..829c18bd68a 100644 --- a/frameworks/CSharp/beetlex/PlatformBenchmarks/HttpHandler.fortunes.cs +++ b/frameworks/CSharp/beetlex/PlatformBenchmarks/HttpHandler.fortunes.cs @@ -1,5 +1,5 @@ -using BeetleX; -using BeetleX.Buffers; + +using BeetleX.Light.Memory; using System; using System.Collections.Generic; using System.Globalization; @@ -13,87 +13,56 @@ namespace PlatformBenchmarks public partial class HttpHandler { + static readonly HtmlEncoder htmlEncoder = CreateHtmlEncoder(); + static HtmlEncoder CreateHtmlEncoder() + { + var settings = new TextEncoderSettings(UnicodeRanges.BasicLatin, UnicodeRanges.Katakana, UnicodeRanges.Hiragana); + settings.AllowCharacter('\u2014'); // allow EM DASH through + return HtmlEncoder.Create(settings); + } + private readonly static AsciiString _fortunesTableStart = "Fortunes"; private readonly static AsciiString _fortunesRowStart = ""; private readonly static AsciiString _fortunesTableEnd = "
idmessage
"; private readonly static AsciiString _fortunesColumn = ""; private readonly static AsciiString _fortunesRowEnd = "
"; - protected HtmlEncoder HtmlEncoder { get; } = CreateHtmlEncoder(); - - private static HtmlEncoder CreateHtmlEncoder() - { - var settings = new TextEncoderSettings(UnicodeRanges.BasicLatin, UnicodeRanges.Katakana, UnicodeRanges.Hiragana); - settings.AllowCharacter('\u2014'); // allow EM DASH through - return HtmlEncoder.Create(settings); - } - public async Task fortunes(PipeStream stream, HttpToken token, ISession session) + public async Task fortunes(IStreamWriter stream) { + ContentLengthMemory content = new ContentLengthMemory(); try { - var data = await token.Db.LoadFortunesRows(); + var data = await this._db.LoadFortunesRows(); stream.Write(_HtmlResultPreamble.Data, 0, _HtmlResultPreamble.Length); - token.ContentLength = stream.Allocate(HttpHandler._LengthSize); + content.Data = GetContentLengthMemory(stream); GMTDate.Default.Write(stream); - token.ContentPostion = stream.CacheLength; - var html = token.GetHtmlBufferWriter(); - html.Reset(); - html.Write(_fortunesTableStart.Data, 0, _fortunesTableStart.Length); + stream.WriteSequenceNetStream.StartWriteLength(); + stream.Write(_fortunesTableStart.Data, 0, _fortunesTableStart.Length); foreach (var item in data) { - html.Write(_fortunesRowStart.Data, 0, _fortunesRowStart.Length); - WriteNumeric(html, (uint)item.Id); - html.Write(_fortunesColumn.Data, 0, _fortunesColumn.Length); - html.Write(HtmlEncoder.Encode(item.Message)); - html.Write(_fortunesRowEnd.Data, 0, _fortunesRowEnd.Length); + stream.Write(_fortunesRowStart.Data, 0, _fortunesRowStart.Length); + stream.WriteString(item.Id.ToString(CultureInfo.InvariantCulture)); + stream.Write(_fortunesColumn.Data, 0, _fortunesColumn.Length); + stream.WriteString(htmlEncoder.Encode(item.Message)); + stream.Write(_fortunesRowEnd.Data, 0, _fortunesRowEnd.Length); } - html.Write(_fortunesTableEnd.Data, 0, _fortunesTableEnd.Length); - stream.Write(html.Data, 0, html.Length); - + stream.Write(_fortunesTableEnd.Data, 0, _fortunesTableEnd.Length); } catch (Exception e_) { - HttpServer.ApiServer.Log(BeetleX.EventArgs.LogType.Error, null, $"fortunes error {e_.Message}@{e_.StackTrace}"); - stream.Write(e_.Message); - } - OnCompleted(stream, session, token); - } - - internal void WriteNumeric(HtmlBufferWriter writer, uint number) - { - const byte AsciiDigitStart = (byte)'0'; - - if (number < 10) - { - writer.Write((byte)(number + AsciiDigitStart)); - + Context.GetLoger(BeetleX.Light.Logs.LogLevel.Error)?.WriteException(Context, "PlatformBenchmarks", "fortunes", e_); + stream.WriteString(e_.Message); } - else if (number < 100) - { - var tens = (byte)((number * 205u) >> 11); // div10, valid to 1028 - var span = new byte[2]; - span[0] = (byte)(tens + AsciiDigitStart); - span[1] = (byte)(number - (tens * 10) + AsciiDigitStart); - writer.Write(span, 0, 2); + var len = stream.WriteSequenceNetStream.EndWriteLength(); + content.Full(len); - } - else if (number < 1000) - { - var digit0 = (byte)((number * 41u) >> 12); // div100, valid to 1098 - var digits01 = (byte)((number * 205u) >> 11); // div10, valid to 1028 - var span = new byte[3]; - span[0] = (byte)(digit0 + AsciiDigitStart); - span[1] = (byte)(digits01 - (digit0 * 10) + AsciiDigitStart); - span[2] = (byte)(number - (digits01 * 10) + AsciiDigitStart); - writer.Write(span, 0, 3); - } } - internal void WriteNumeric(PipeStream stream, uint number) + internal void WriteNumeric(IStreamWriter stream, uint number) { const byte AsciiDigitStart = (byte)'0'; diff --git a/frameworks/CSharp/beetlex/PlatformBenchmarks/HttpHandler.json.cs b/frameworks/CSharp/beetlex/PlatformBenchmarks/HttpHandler.json.cs index 1577248fa81..1bfa2d8863f 100644 --- a/frameworks/CSharp/beetlex/PlatformBenchmarks/HttpHandler.json.cs +++ b/frameworks/CSharp/beetlex/PlatformBenchmarks/HttpHandler.json.cs @@ -1,8 +1,10 @@ using BeetleX; -using BeetleX.Buffers; -using SpanJson; + +using BeetleX.Light.Memory; + using System; using System.Collections.Generic; +using System.IO; using System.Text; using System.Text.Json; using System.Threading.Tasks; @@ -11,29 +13,21 @@ namespace PlatformBenchmarks { public partial class HttpHandler { - - private static readonly JsonSerializerOptions SerializerOptions = new JsonSerializerOptions(); - private static Utf8JsonWriter GetUtf8JsonWriter(PipeStream stream, HttpToken token) - { - var buffer = stream.CreateBufferWriter(); - if (token.Utf8JsonWriter == null) - { - token.Utf8JsonWriter = new Utf8JsonWriter(buffer, new JsonWriterOptions { SkipValidation = true }); - } - var writer = token.Utf8JsonWriter; - writer.Reset(buffer); - return writer; - } - - public ValueTask Json(PipeStream stream, HttpToken token, ISession session) + public void Json(IStreamWriter stream) { stream.Write(_jsonPreamble.Data, 0, _jsonPreamble.Length); GMTDate.Default.Write(stream); - System.Text.Json.JsonSerializer.Serialize(GetUtf8JsonWriter(stream, token), new JsonMessage { message = "Hello, World!" }, SerializerOptions); - OnCompleted(stream, session, token); - return ValueTask.CompletedTask; + var jsonWriter = GetJsonWriter(stream); + using (var unflush = stream.UnFlush()) + { + jsonWriter.WriteStartObject(); + jsonWriter.WriteString("message", "Hello, World!"); + jsonWriter.WriteEndObject(); + jsonWriter.Flush(); + } + } } } diff --git a/frameworks/CSharp/beetlex/PlatformBenchmarks/HttpHandler.plaintext.cs b/frameworks/CSharp/beetlex/PlatformBenchmarks/HttpHandler.plaintext.cs index 83741829b84..a011d52f7f4 100644 --- a/frameworks/CSharp/beetlex/PlatformBenchmarks/HttpHandler.plaintext.cs +++ b/frameworks/CSharp/beetlex/PlatformBenchmarks/HttpHandler.plaintext.cs @@ -1,5 +1,5 @@ -using BeetleX; -using BeetleX.Buffers; + +using BeetleX.Light.Memory; using System; using System.Collections.Generic; using System.Text; @@ -11,13 +11,11 @@ public partial class HttpHandler { - public ValueTask Plaintext(PipeStream stream, HttpToken token, ISession session) + public void Plaintext(IStreamWriter stream) { stream.Write(_plaintextPreamble.Data, 0, _plaintextPreamble.Length); GMTDate.Default.Write(stream); stream.Write(_result_plaintext.Data, 0, _result_plaintext.Length); - OnCompleted(stream, session, token); - return ValueTask.CompletedTask; } } } diff --git a/frameworks/CSharp/beetlex/PlatformBenchmarks/HttpHandler.queries.cs b/frameworks/CSharp/beetlex/PlatformBenchmarks/HttpHandler.queries.cs index 8027191667c..53eef8a31fb 100644 --- a/frameworks/CSharp/beetlex/PlatformBenchmarks/HttpHandler.queries.cs +++ b/frameworks/CSharp/beetlex/PlatformBenchmarks/HttpHandler.queries.cs @@ -1,24 +1,24 @@ -using BeetleX; -using BeetleX.Buffers; -using SpanJson; +using BeetleX.Light.Memory; using System; using System.Collections.Generic; +using System.IO; using System.Text; +using System.Text.Json; using System.Threading.Tasks; namespace PlatformBenchmarks { public partial class HttpHandler { - public async ValueTask queries(string queryString, PipeStream stream, HttpToken token, ISession session) + public async ValueTask queries(string queryString, IStreamWriter stream) { int count = 1; - if(!string.IsNullOrEmpty(queryString)) + if (!string.IsNullOrEmpty(queryString)) { var values = queryString.Split('='); - if(values.Length>1) + if (values.Length > 1) { - if(int.TryParse(values[1],out int size)) + if (int.TryParse(values[1], out int size)) { count = size; } @@ -28,20 +28,39 @@ public async ValueTask queries(string queryString, PipeStream stream, HttpToken count = 500; if (count < 1) count = 1; + ContentLengthMemory content = new ContentLengthMemory(); try { - var data = await token.Db.LoadMultipleQueriesRows(count); + var data = await _db.LoadMultipleQueriesRows(count); stream.Write(_jsonResultPreamble.Data, 0, _jsonResultPreamble.Length); - token.ContentLength = stream.Allocate(HttpHandler._LengthSize); + content.Data = GetContentLengthMemory(stream); GMTDate.Default.Write(stream); - token.ContentPostion = stream.CacheLength; - System.Text.Json.JsonSerializer.Serialize(GetUtf8JsonWriter(stream, token), data, SerializerOptions); + + stream.WriteSequenceNetStream.StartWriteLength(); + + var jsonWriter = GetJsonWriter(stream); + using (var unflush = stream.UnFlush()) + { + jsonWriter.WriteStartArray(); + foreach (var item in data) + { + jsonWriter.WriteStartObject(); + jsonWriter.WriteNumber("Id", item.Id); + jsonWriter.WriteNumber("RandomNumber", item.RandomNumber); + jsonWriter.WriteEndObject(); + } + jsonWriter.WriteEndArray(); + jsonWriter.Flush(); + + } } catch (Exception e_) { - stream.Write(e_.Message); + Context.GetLoger(BeetleX.Light.Logs.LogLevel.Error)?.WriteException(Context, "PlatformBenchmarks", "queries", e_); + stream.WriteString(e_.Message); } - OnCompleted(stream, session, token); + var len = stream.WriteSequenceNetStream.EndWriteLength(); + content.Full(len); } } } diff --git a/frameworks/CSharp/beetlex/PlatformBenchmarks/HttpHandler.updates.cs b/frameworks/CSharp/beetlex/PlatformBenchmarks/HttpHandler.updates.cs index 8f3e6d84815..255a430c070 100644 --- a/frameworks/CSharp/beetlex/PlatformBenchmarks/HttpHandler.updates.cs +++ b/frameworks/CSharp/beetlex/PlatformBenchmarks/HttpHandler.updates.cs @@ -1,16 +1,17 @@ -using BeetleX; -using BeetleX.Buffers; -using SpanJson; + +using BeetleX.Light.Memory; using System; using System.Collections.Generic; +using System.IO; using System.Text; +using System.Text.Json; using System.Threading.Tasks; namespace PlatformBenchmarks { public partial class HttpHandler { - public async ValueTask updates(string queryString, PipeStream stream, HttpToken token, ISession session) + public async ValueTask updates(string queryString, IStreamWriter stream) { int count = 1; if (!string.IsNullOrEmpty(queryString)) @@ -28,22 +29,24 @@ public async ValueTask updates(string queryString, PipeStream stream, HttpToken count = 500; if (count < 1) count = 1; + ContentLengthMemory content = new ContentLengthMemory(); try { - var data = await token.Db.LoadMultipleUpdatesRows(count); + var data = await _db.LoadMultipleUpdatesRows(count); stream.Write(_jsonResultPreamble.Data, 0, _jsonResultPreamble.Length); - token.ContentLength = stream.Allocate(HttpHandler._LengthSize); + content.Data = GetContentLengthMemory(stream); GMTDate.Default.Write(stream); - token.ContentPostion = stream.CacheLength; - System.Text.Json.JsonSerializer.Serialize(GetUtf8JsonWriter(stream, token), data, SerializerOptions); + stream.WriteSequenceNetStream.StartWriteLength(); + JsonSerializer.Serialize((Stream)stream.WriteSequenceNetStream, data); } catch (Exception e_) { - HttpServer.ApiServer.Log(BeetleX.EventArgs.LogType.Error, null, $"updates error {e_.Message}@{e_.StackTrace}"); - stream.Write(e_.Message); + Context.GetLoger(BeetleX.Light.Logs.LogLevel.Error)?.WriteException(Context, "PlatformBenchmarks", "updates", e_); + stream.WriteString(e_.Message); } - OnCompleted(stream, session, token); + var len = stream.WriteSequenceNetStream.EndWriteLength(); + content.Full(len); } } } diff --git a/frameworks/CSharp/beetlex/PlatformBenchmarks/HttpServer.cs b/frameworks/CSharp/beetlex/PlatformBenchmarks/HttpServer.cs index 422da242a7a..b8ee7c5f495 100644 --- a/frameworks/CSharp/beetlex/PlatformBenchmarks/HttpServer.cs +++ b/frameworks/CSharp/beetlex/PlatformBenchmarks/HttpServer.cs @@ -1,5 +1,5 @@ -using BeetleX; -using BeetleX.EventArgs; +using BeetleX.Light; +using BeetleX.Light.Logs; using Microsoft.Extensions.Hosting; using System; using System.Collections.Generic; @@ -11,38 +11,44 @@ namespace PlatformBenchmarks { public class HttpServer : IHostedService { - public static IServer ApiServer; + private static NetServer _apiServer; public virtual Task StartAsync(CancellationToken cancellationToken) { + ThreadPool.SetMinThreads(Environment.ProcessorCount * 2, Environment.ProcessorCount * 2); + Constants.MemorySegmentMinSize = 1024 * 8; + Constants.MemorySegmentMaxSize = 1024 * 8; + Constants.InitMemoryBlock(); ArraySegment date = GMTDate.Default.DATE; - ServerOptions serverOptions = new ServerOptions(); - serverOptions.LogLevel = LogType.Error; - serverOptions.DefaultListen.Port = 8080; - serverOptions.Statistical = false; - serverOptions.BufferPoolMaxMemory = 1000; - serverOptions.BufferPoolSize = 1024 * 24; - ApiServer = SocketFactory.CreateTcpServer(serverOptions); - ApiServer.Open(); + _apiServer = new NetServer(); + _apiServer.Options.LogLevel = BeetleX.Light.Logs.LogLevel.Error; + _apiServer.Options.AddLogOutputHandler(); + _apiServer.Options.SetDefaultListen(o => + { + o.Port = 8080; + }); + _apiServer.Start(); + + if (!Program.UpDB) { - RawDb._connectionString = "Server=tfb-database;Database=hello_world;User Id=benchmarkdbuser;Password=benchmarkdbpass;Maximum Pool Size=256;NoResetOnClose=true;Enlist=false;Max Auto Prepare=4;Multiplexing=true;Write Coalescing Delay Us=500;Write Coalescing Buffer Threshold Bytes=1000"; - // RawDb._connectionString = "Server=192.168.2.19;Database=hello_world;User Id=benchmarkdbuser;Password=benchmarkdbpass;Maximum Pool Size=256;NoResetOnClose=true;Enlist=false;Max Auto Prepare=3"; + RawDb._connectionString = "Server=tfb-database;Database=hello_world;User Id=benchmarkdbuser;Password=benchmarkdbpass;SSL Mode=Disable;Maximum Pool Size=64;NoResetOnClose=true;Enlist=false;Max Auto Prepare=4;Multiplexing=true;Write Coalescing Buffer Threshold Bytes=1000"; + //RawDb._connectionString = "Server=127.0.0.1;Database=hello_world;User Id=benchmarkdbuser;Password=benchmarkdbpass;Maximum Pool Size=256;NoResetOnClose=true;Enlist=false;Max Auto Prepare=3"; } else { - RawDb._connectionString = "Server=tfb-database;Database=hello_world;User Id=benchmarkdbuser;Password=benchmarkdbpass;Maximum Pool Size=64;NoResetOnClose=true;Enlist=false;Max Auto Prepare=3;Multiplexing=true;Write Coalescing Delay Us=500;Write Coalescing Buffer Threshold Bytes=1000"; - // RawDb._connectionString = "Server=192.168.2.19;Database=hello_world;User Id=benchmarkdbuser;Password=benchmarkdbpass;Maximum Pool Size=64;NoResetOnClose=true;Enlist=false;Max Auto Prepare=3"; + RawDb._connectionString = "Server=tfb-database;Database=hello_world;User Id=benchmarkdbuser;Password=benchmarkdbpass;SSL Mode=Disable;Maximum Pool Size=64;NoResetOnClose=true;Enlist=false;Max Auto Prepare=4;Multiplexing=true;Write Coalescing Buffer Threshold Bytes=1000"; + //RawDb._connectionString = "Server=127.0.0.1;Database=hello_world;User Id=benchmarkdbuser;Password=benchmarkdbpass;Maximum Pool Size=64;NoResetOnClose=true;Enlist=false;Max Auto Prepare=3"; } - // ApiServer.Log(LogType.Info, null, $"Debug mode [{Program.Debug}]"); + // ApiServer.Log(LogType.Info, null, $"Debug mode [{Program.Debug}]"); return Task.CompletedTask; } public virtual Task StopAsync(CancellationToken cancellationToken) { - ApiServer.Dispose(); + return Task.CompletedTask; } } diff --git a/frameworks/CSharp/beetlex/PlatformBenchmarks/HttpToken.cs b/frameworks/CSharp/beetlex/PlatformBenchmarks/HttpToken.cs index 3d85f8426e5..09d845f6b7e 100644 --- a/frameworks/CSharp/beetlex/PlatformBenchmarks/HttpToken.cs +++ b/frameworks/CSharp/beetlex/PlatformBenchmarks/HttpToken.cs @@ -1,76 +1,76 @@ -using BeetleX; -using BeetleX.Buffers; -using BeetleX.Dispatchs; -using System; -using System.Collections.Concurrent; -using System.Text; -using System.Text.Json; +//using BeetleX; +//using BeetleX.Buffers; +//using BeetleX.Dispatchs; +//using System; +//using System.Collections.Concurrent; +//using System.Text; +//using System.Text.Json; -namespace PlatformBenchmarks -{ - public class HttpToken - { - private byte[] mLengthBuffer = new byte[10]; +//namespace PlatformBenchmarks +//{ +// public class HttpToken +// { +// private byte[] mLengthBuffer = new byte[10]; - public RawDb Db { get; set; } +// public RawDb Db { get; set; } - public HttpToken() - { +// public HttpToken() +// { - } +// } - public SingleThreadDispatcher ThreadDispatcher { get; set; } +// public SingleThreadDispatcher ThreadDispatcher { get; set; } - public ConcurrentQueue Requests { get; set; } = new ConcurrentQueue(); +// public ConcurrentQueue Requests { get; set; } = new ConcurrentQueue(); - public Utf8JsonWriter Utf8JsonWriter { get; set; } +// public Utf8JsonWriter Utf8JsonWriter { get; set; } - public ISession Session { get; set; } +// public ISession Session { get; set; } - public RequestData CurrentRequest { get; set; } +// public RequestData CurrentRequest { get; set; } - private HtmlBufferWriter mHtmlBufferWriter = null; +// private HtmlBufferWriter mHtmlBufferWriter = null; - public HtmlBufferWriter GetHtmlBufferWriter() - { - if (mHtmlBufferWriter == null) - mHtmlBufferWriter = new HtmlBufferWriter(2048); - return mHtmlBufferWriter; - } +// public HtmlBufferWriter GetHtmlBufferWriter() +// { +// if (mHtmlBufferWriter == null) +// mHtmlBufferWriter = new HtmlBufferWriter(2048); +// return mHtmlBufferWriter; +// } - public byte[] GetLengthBuffer(string length) - { - Encoding.ASCII.GetBytes(length, 0, length.Length, mLengthBuffer, 0); - for (int i = length.Length; i < mLengthBuffer.Length; i++) - { - mLengthBuffer[i] = 32; - } - mLengthBuffer[6] = (byte)'\r'; - mLengthBuffer[7] = (byte)'\n'; - return mLengthBuffer; - } +// public byte[] GetLengthBuffer(string length) +// { +// Encoding.ASCII.GetBytes(length, 0, length.Length, mLengthBuffer, 0); +// for (int i = length.Length; i < mLengthBuffer.Length; i++) +// { +// mLengthBuffer[i] = 32; +// } +// mLengthBuffer[6] = (byte)'\r'; +// mLengthBuffer[7] = (byte)'\n'; +// return mLengthBuffer; +// } - public int ContentPostion { get; set; } +// public int ContentPostion { get; set; } - public MemoryBlockCollection ContentLength { get; set; } +// public MemoryBlockCollection ContentLength { get; set; } - public void FullLength(string length) - { - var item = GetLengthBuffer(length); - ContentLength.Full(item); - } +// public void FullLength(string length) +// { +// var item = GetLengthBuffer(length); +// ContentLength.Full(item); +// } - private int mProcessStatus = 0; +// private int mProcessStatus = 0; - public void CompletedProcess() - { - System.Threading.Interlocked.Exchange(ref mProcessStatus, 0); - } +// public void CompletedProcess() +// { +// System.Threading.Interlocked.Exchange(ref mProcessStatus, 0); +// } - public bool EnterProcess() - { - return System.Threading.Interlocked.CompareExchange(ref mProcessStatus, 1, 0) == 0; - } +// public bool EnterProcess() +// { +// return System.Threading.Interlocked.CompareExchange(ref mProcessStatus, 1, 0) == 0; +// } - } -} +// } +//} diff --git a/frameworks/CSharp/beetlex/PlatformBenchmarks/NetApplication.cs b/frameworks/CSharp/beetlex/PlatformBenchmarks/NetApplication.cs new file mode 100644 index 00000000000..da5b14f5b96 --- /dev/null +++ b/frameworks/CSharp/beetlex/PlatformBenchmarks/NetApplication.cs @@ -0,0 +1,19 @@ +using BeetleX.Light; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net.Sockets; +using System.Text; +using System.Threading.Tasks; + +namespace PlatformBenchmarks +{ + public class HttpNetApplication : ApplicationBase + { + public override bool Connecting(Socket socket, ListenHandler handler) + { + socket.NoDelay = true; + return true; + } + } +} diff --git a/frameworks/CSharp/beetlex/PlatformBenchmarks/PlatformBenchmarks.csproj b/frameworks/CSharp/beetlex/PlatformBenchmarks/PlatformBenchmarks.csproj index d3c07772725..10202a882be 100644 --- a/frameworks/CSharp/beetlex/PlatformBenchmarks/PlatformBenchmarks.csproj +++ b/frameworks/CSharp/beetlex/PlatformBenchmarks/PlatformBenchmarks.csproj @@ -2,17 +2,17 @@ Exe - net5.0 + net8.0 true - - - - - + + + + + diff --git a/frameworks/CSharp/beetlex/PlatformBenchmarks/Program.cs b/frameworks/CSharp/beetlex/PlatformBenchmarks/Program.cs index 774acc842ee..3819a6c7e1d 100644 --- a/frameworks/CSharp/beetlex/PlatformBenchmarks/Program.cs +++ b/frameworks/CSharp/beetlex/PlatformBenchmarks/Program.cs @@ -1,6 +1,7 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using System; +using System.IO; namespace PlatformBenchmarks { @@ -14,7 +15,12 @@ class Program public static void Main(string[] args) { //Debug = (args != null && args.Length > 0 && args[0] == "debug"); + var data = GMTDate.Default.DATE; UpDB = (args != null && args.Length > 0 && args[0] == "updb"); + UpdateCommandsCached.Init(); + //HttpServer server = new HttpServer(); + //server.StartAsync(default); + //Console.ReadLine(); new HostBuilder().ConfigureServices(delegate (HostBuilderContext hostContext, IServiceCollection services) { services.AddHostedService(); diff --git a/frameworks/CSharp/beetlex/PlatformBenchmarks/RequestData.cs b/frameworks/CSharp/beetlex/PlatformBenchmarks/RequestData.cs index ab5b8080aee..f4d45c9174e 100644 --- a/frameworks/CSharp/beetlex/PlatformBenchmarks/RequestData.cs +++ b/frameworks/CSharp/beetlex/PlatformBenchmarks/RequestData.cs @@ -1,4 +1,5 @@ using System; +using System.Buffers; using System.Collections.Generic; using System.Linq; using System.Text; @@ -6,24 +7,12 @@ namespace PlatformBenchmarks { - public class RequestData : IDisposable + public class RequestData { - public ArraySegment Data { get; set; } - - public ReadOnlySpan GetSpan() - { - return new ReadOnlySpan(Data.Array, Data.Offset, Data.Count); - } - - public void Dispose() - { - - //System.Buffers.ArrayPool.Shared.Return(Data.Array); - } public string QueryString { get; set; } - public ActionType Action { get; set; } + public ActionType? Action { get; set; } } diff --git a/frameworks/CSharp/beetlex/beetlex-core-updb.dockerfile b/frameworks/CSharp/beetlex/beetlex-core-updb.dockerfile deleted file mode 100644 index b813173db92..00000000000 --- a/frameworks/CSharp/beetlex/beetlex-core-updb.dockerfile +++ /dev/null @@ -1,12 +0,0 @@ -FROM mcr.microsoft.com/dotnet/sdk:5.0-alpine AS build -WORKDIR /app -COPY PlatformBenchmarks . -RUN dotnet publish -c Release -o out - -FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS runtime -WORKDIR /app -COPY --from=build /app/out ./ - -EXPOSE 8080 - -ENTRYPOINT ["dotnet", "PlatformBenchmarks.dll","updb"] diff --git a/frameworks/CSharp/beetlex/beetlex-core.dockerfile b/frameworks/CSharp/beetlex/beetlex-core.dockerfile index 84f4b69a3ff..cd9b870469a 100644 --- a/frameworks/CSharp/beetlex/beetlex-core.dockerfile +++ b/frameworks/CSharp/beetlex/beetlex-core.dockerfile @@ -1,9 +1,9 @@ -FROM mcr.microsoft.com/dotnet/sdk:5.0-alpine AS build +FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build WORKDIR /app COPY PlatformBenchmarks . RUN dotnet publish -c Release -o out -FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS runtime +FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime WORKDIR /app COPY --from=build /app/out ./ diff --git a/frameworks/CSharp/beetlex/beetlex.dockerfile b/frameworks/CSharp/beetlex/beetlex.dockerfile index 8540e376359..78deeac145e 100644 --- a/frameworks/CSharp/beetlex/beetlex.dockerfile +++ b/frameworks/CSharp/beetlex/beetlex.dockerfile @@ -1,9 +1,9 @@ -FROM mcr.microsoft.com/dotnet/sdk:5.0-alpine AS build +FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build WORKDIR /app COPY Benchmarks . RUN dotnet publish -c Release -o out -FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS runtime +FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS runtime WORKDIR /app COPY --from=build /app/out ./ diff --git a/frameworks/CSharp/beetlex/benchmark_config.json b/frameworks/CSharp/beetlex/benchmark_config.json index b5e85bfbf49..67f3a560196 100644 --- a/frameworks/CSharp/beetlex/benchmark_config.json +++ b/frameworks/CSharp/beetlex/benchmark_config.json @@ -48,25 +48,6 @@ "display_name": "beetlex-core", "notes": "", "versus": "aspcore" - }, - "core-updb": { - "update_url": "/updates?queries=", - "fortune_url": "/fortunes", - "port": 8080, - "approach": "Realistic", - "classification": "Platform", - "database": "Postgres", - "framework": "beetlex", - "language": "C#", - "orm": "Raw", - "platform": ".NET", - "flavor": "CoreCLR", - "webserver": "beetlex", - "os": "Linux", - "database_os": "Linux", - "display_name": "beetlex-core-updb", - "notes": "", - "versus": "aspcore" } } ] diff --git a/frameworks/CSharp/beetlex/config.toml b/frameworks/CSharp/beetlex/config.toml index 3e389ec3a67..ec807d12eb2 100644 --- a/frameworks/CSharp/beetlex/config.toml +++ b/frameworks/CSharp/beetlex/config.toml @@ -36,15 +36,3 @@ platform = ".NET" webserver = "beetlex" versus = "aspcore" -[core-updb] -urls.update = "/updates?queries=" -urls.fortune = "/fortunes" -approach = "Realistic" -classification = "Platform" -database = "Postgres" -database_os = "Linux" -os = "Linux" -orm = "Raw" -platform = ".NET" -webserver = "beetlex" -versus = "aspcore" From 24acdc5e625bb464157e0d379f28043fd6751f15 Mon Sep 17 00:00:00 2001 From: Petrik de Heus Date: Sat, 8 Jun 2024 00:03:15 +0200 Subject: [PATCH 21/45] [crystal|kemal] Update dependencies (#9063) --- .../kemal/kemal-concurrent-queries.dockerfile | 2 +- frameworks/Crystal/kemal/kemal.dockerfile | 2 +- frameworks/Crystal/kemal/shard.lock | 42 +++++++++---------- frameworks/Crystal/kemal/shard.yml | 6 +-- 4 files changed, 26 insertions(+), 26 deletions(-) diff --git a/frameworks/Crystal/kemal/kemal-concurrent-queries.dockerfile b/frameworks/Crystal/kemal/kemal-concurrent-queries.dockerfile index 549ca8e3cb6..0f4f2b39231 100644 --- a/frameworks/Crystal/kemal/kemal-concurrent-queries.dockerfile +++ b/frameworks/Crystal/kemal/kemal-concurrent-queries.dockerfile @@ -1,4 +1,4 @@ -FROM crystallang/crystal:0.32.1 +FROM crystallang/crystal:1.12.1 WORKDIR /kemal COPY views views diff --git a/frameworks/Crystal/kemal/kemal.dockerfile b/frameworks/Crystal/kemal/kemal.dockerfile index 03bdf0c4ef3..baafb59538e 100644 --- a/frameworks/Crystal/kemal/kemal.dockerfile +++ b/frameworks/Crystal/kemal/kemal.dockerfile @@ -1,4 +1,4 @@ -FROM crystallang/crystal:0.32.1 +FROM crystallang/crystal:1.12.1 WORKDIR /kemal COPY views views diff --git a/frameworks/Crystal/kemal/shard.lock b/frameworks/Crystal/kemal/shard.lock index 8d4253e5645..c7bf83e3078 100644 --- a/frameworks/Crystal/kemal/shard.lock +++ b/frameworks/Crystal/kemal/shard.lock @@ -1,38 +1,38 @@ -version: 1.0 +version: 2.0 shards: + backtracer: + git: https://github.com/sija/backtracer.cr.git + version: 1.2.2 + commander: - github: snluu/commander - commit: 9396efd427f06f0f6de5206f6e81d54fcd254abe + git: https://github.com/snluu/commander.git + version: 0.1.0+git.commit.9396efd427f06f0f6de5206f6e81d54fcd254abe db: - github: crystal-lang/crystal-db - version: 0.8.0 + git: https://github.com/crystal-lang/crystal-db.git + version: 0.13.1 exception_page: - github: crystal-loot/exception_page - version: 0.1.2 + git: https://github.com/crystal-loot/exception_page.git + version: 0.4.1 kemal: - github: kemalcr/kemal - version: 0.26.1 - - kilt: - github: jeromegn/kilt - version: 0.4.0 + git: https://github.com/kemalcr/kemal.git + version: 1.5.0 pg: - github: will/crystal-pg - version: 0.20.0 + git: https://github.com/will/crystal-pg.git + version: 0.28.0 pool: - github: ysbaddaden/pool - version: 0.2.3 + git: https://github.com/ysbaddaden/pool.git + version: 0.3.0 radix: - github: luislavena/radix - version: 0.3.9 + git: https://github.com/luislavena/radix.git + version: 0.4.1 redis: - github: stefanwille/crystal-redis - version: 2.5.3 + git: https://github.com/stefanwille/crystal-redis.git + version: 2.8.0 diff --git a/frameworks/Crystal/kemal/shard.yml b/frameworks/Crystal/kemal/shard.yml index 1a9a88e8e8a..2277be2b8b7 100644 --- a/frameworks/Crystal/kemal/shard.yml +++ b/frameworks/Crystal/kemal/shard.yml @@ -6,12 +6,12 @@ license: MIT dependencies: pg: github: will/crystal-pg - version: 0.20.0 + version: 0.28.0 kemal: github: kemalcr/kemal - version: 0.26.1 + version: 1.5.0 redis: github: stefanwille/crystal-redis - version: 2.5.3 + version: 2.8.0 commander: github: snluu/commander From cea238462d45373dceeb2eead62e88630fe27c43 Mon Sep 17 00:00:00 2001 From: Nate Date: Fri, 7 Jun 2024 15:15:44 -0700 Subject: [PATCH 22/45] fix for real (#9103) --- toolset/continuous/tfb-shutdown.sh | 6 ------ toolset/continuous/tfb-startup.sh | 6 ++++++ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/toolset/continuous/tfb-shutdown.sh b/toolset/continuous/tfb-shutdown.sh index db96b07941b..d257182b623 100644 --- a/toolset/continuous/tfb-shutdown.sh +++ b/toolset/continuous/tfb-shutdown.sh @@ -30,10 +30,4 @@ ssh techempower@$TFB_DATABASE_HOST "$(typeset -f docker_clean); docker_clean" echo "running docker_clean on client host" ssh techempower@$TFB_CLIENT_HOST "$(typeset -f docker_clean); docker_clean" -if [ -z "$TFB_RUN_ORDER" ]; then - export TFB_RUN_ORDER="reverse" -else - unset TFB_RUN_ORDER -fi - echo "done with tfb-shutdown script" diff --git a/toolset/continuous/tfb-startup.sh b/toolset/continuous/tfb-startup.sh index b0be7622bf5..c008df0d07f 100644 --- a/toolset/continuous/tfb-startup.sh +++ b/toolset/continuous/tfb-startup.sh @@ -20,6 +20,12 @@ git clone \ echo "moving to tfb directory" cd $TFB_REPOPARENT/$TFB_REPONAME +if [ -z "$TFB_RUN_ORDER" ]; then + export TFB_RUN_ORDER="reverse" +else + unset TFB_RUN_ORDER +fi + echo "building tfb docker image" docker build -t techempower/tfb \ --build-arg USER_ID=$(id -u) \ From ca97cdeda8dd11e43083ab8b147ecdad3483787a Mon Sep 17 00:00:00 2001 From: Jonas Konrad Date: Tue, 11 Jun 2024 22:11:45 +0200 Subject: [PATCH 23/45] [micronaut] Update to micronaut-platform 4.5.0 (#9114) * Disable testresources and downgrade docker images This is an attempt to fix the JIT-only regression introduced by f2b0b607acb50c71890f00693bc2f467d217ba4f . * Update to micronaut-platform 4.5.0 --- frameworks/Java/micronaut/gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frameworks/Java/micronaut/gradle.properties b/frameworks/Java/micronaut/gradle.properties index 6d8a8be3f5c..ba63eab22c9 100644 --- a/frameworks/Java/micronaut/gradle.properties +++ b/frameworks/Java/micronaut/gradle.properties @@ -1 +1 @@ -micronautVersion=4.4.3 +micronautVersion=4.5.0 From d4d455765458927e8ee42346a45ee46a3c72e136 Mon Sep 17 00:00:00 2001 From: itrofimow Date: Wed, 12 Jun 2024 00:12:29 +0400 Subject: [PATCH 24/45] [C++] [userver] fix docker images (#9113) --- frameworks/C++/userver/userver-bare.dockerfile | 2 +- frameworks/C++/userver/userver.dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/frameworks/C++/userver/userver-bare.dockerfile b/frameworks/C++/userver/userver-bare.dockerfile index 4605e6bb582..a318a9601b7 100644 --- a/frameworks/C++/userver/userver-bare.dockerfile +++ b/frameworks/C++/userver/userver-bare.dockerfile @@ -1,4 +1,4 @@ -FROM ghcr.io/userver-framework/ubuntu-userver-build-base:v2 AS builder +FROM ghcr.io/userver-framework/ubuntu-22.04-userver-pg AS builder RUN apt update && \ apt install -y lsb-release wget software-properties-common gnupg && \ diff --git a/frameworks/C++/userver/userver.dockerfile b/frameworks/C++/userver/userver.dockerfile index cbdceea1862..9b45edd2418 100644 --- a/frameworks/C++/userver/userver.dockerfile +++ b/frameworks/C++/userver/userver.dockerfile @@ -1,4 +1,4 @@ -FROM ghcr.io/userver-framework/ubuntu-userver-build-base:v2 AS builder +FROM ghcr.io/userver-framework/ubuntu-22.04-userver-pg AS builder RUN apt update && \ apt install -y lsb-release wget software-properties-common gnupg && \ From d5d45b16e3bc1c7b4d7c34caeca9903bcac9ff62 Mon Sep 17 00:00:00 2001 From: Vladimir Shchur Date: Tue, 11 Jun 2024 13:12:54 -0700 Subject: [PATCH 25/45] [F#/Oxpecker] Improved json, fortunes and updates benchmarks (#9112) * [F#/Oxpecker] Improved json and fortunes bencmarks * [F#/Oxpecker] Improved multi-update benchmark * [F#/Oxpecker] Refactoring --- frameworks/FSharp/oxpecker/src/App/Program.fs | 78 ++++++++++--------- 1 file changed, 43 insertions(+), 35 deletions(-) diff --git a/frameworks/FSharp/oxpecker/src/App/Program.fs b/frameworks/FSharp/oxpecker/src/App/Program.fs index 944e0518155..bdb95afa593 100644 --- a/frameworks/FSharp/oxpecker/src/App/Program.fs +++ b/frameworks/FSharp/oxpecker/src/App/Program.fs @@ -7,12 +7,17 @@ open Oxpecker [] module Common = + [] [] - type Fortune = - { - id : int - message : string - } + type JsonMessage = { + message : string + } + + [] + type Fortune = { + id: int + message: string + } [] let ConnectionString = "Server=tfb-database;Database=hello_world;User Id=benchmarkdbuser;Password=benchmarkdbpass;SSL Mode=Disable;Maximum Pool Size=1024;NoResetOnClose=true;Enlist=false;Max Auto Prepare=4;Multiplexing=true;Write Coalescing Buffer Threshold Bytes=1000" @@ -43,13 +48,13 @@ module HtmlViews = th() { raw "message" } } - let fortunes (fortunes: Fortune[]) = + let fortunes fortunesData = table() { fortunesTableHeader - for f in fortunes do + for fortune in fortunesData do tr() { - td() { raw <| string f.id } - td() { f.message } + td() { raw <| string fortune.id } + td() { fortune.message } } } |> layout @@ -67,13 +72,11 @@ module HttpHandlers = message = "Additional fortune added at request time." } - let private renderFortunes (ctx: HttpContext) dbFortunes = - let augmentedData = [| - yield! dbFortunes - extra - |] - Array.Sort(augmentedData, FortuneComparer) - augmentedData |> HtmlViews.fortunes |> ctx.WriteHtmlView + let rec private renderFortunes (ctx: HttpContext) (dbFortunes: Fortune seq) = + let data = dbFortunes.AsList() + data.Add extra + data.Sort FortuneComparer + data |> HtmlViews.fortunes |> ctx.WriteHtmlView let private fortunes : EndpointHandler = fun ctx -> @@ -85,11 +88,10 @@ module HttpHandlers = [] [] - type World = - { - id: int - randomnumber: int - } + type World = { + id: int + randomnumber: int + } let private readSingleRow (conn: NpgsqlConnection) = conn.QueryFirstOrDefaultAsync( @@ -127,7 +129,7 @@ module HttpHandlers = } let private maxBatch = 500 - let mutable private queries = Array.zeroCreate (maxBatch + 1) + let private queries = Array.zeroCreate (maxBatch + 1) let private batchUpdateString batchSize = match queries[batchSize] with @@ -141,7 +143,17 @@ module HttpHandlers = let result = sb.ToString() queries[batchSize] <- result result - | q -> q + | q -> + q + + let private generateParameters (results: World[]) = + let parameters = Dictionary() + for i in 0..results.Length-1 do + let randomNumber = Random.Shared.Next(1, 10001) + parameters[$"@Rn_{i}"] <- randomNumber + parameters[$"@Id_{i}"] <- results[i].id + results[i] <- { results[i] with randomnumber = randomNumber } + parameters let private multipleUpdates : EndpointHandler = fun ctx -> @@ -153,12 +165,7 @@ module HttpHandlers = for i in 0..results.Length-1 do let! result = readSingleRow conn results[i] <- result - let parameters = Dictionary() - for i in 0..results.Length-1 do - let randomNumber = Random.Shared.Next(1, 10001) - parameters[$"@Rn_{i}"] <- randomNumber - parameters[$"@Id_{i}"] <- results[i].id - results[i] <- { results[i] with randomnumber = randomNumber } + let parameters = generateParameters results let! _ = conn.ExecuteAsync(batchUpdateString count, parameters) return! ctx.WriteJsonChunked results } @@ -177,7 +184,7 @@ module HttpHandlers = let endpoints = [| route "/plaintext" <| utf8Const "Hello, World!" - route "/json"<| jsonSimple {| message = "Hello, World!" |} + route "/json" <| jsonSimple { message = "Hello, World!" } route "/fortunes" fortunes route "/db" singleQuery route "/queries/{count?}" multipleQueries @@ -195,11 +202,12 @@ module Main = let builder = WebApplication.CreateBuilder(args) builder.Services .AddRouting() - .AddOxpecker() - |> ignore - builder.Logging.ClearProviders() |> ignore + .AddOxpecker() |> ignore + builder.Logging + .ClearProviders() |> ignore let app = builder.Build() - app.UseRouting() - .UseOxpecker HttpHandlers.endpoints |> ignore + app + .UseRouting() + .UseOxpecker(HttpHandlers.endpoints) |> ignore app.Run() 0 \ No newline at end of file From 31ef34b4e929103fd31493716eeaf9cb30a28715 Mon Sep 17 00:00:00 2001 From: Giovanni Barillari Date: Tue, 11 Jun 2024 22:13:13 +0200 Subject: [PATCH 26/45] [Python] Bump granian to 1.4 (#9111) * [Python] Bump granian to 1.4 * [Python] Update Emmett server params --- frameworks/Python/emmett/run.py | 3 +-- frameworks/Python/granian/requirements.txt | 2 +- frameworks/Python/granian/run.py | 5 ++--- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/frameworks/Python/emmett/run.py b/frameworks/Python/emmett/run.py index 658eadb7d5f..42679101ea0 100644 --- a/frameworks/Python/emmett/run.py +++ b/frameworks/Python/emmett/run.py @@ -12,8 +12,7 @@ host="0.0.0.0", port=8080, workers=cpus, - threads=2, - backlog=2048, + backlog=16384, threading_mode='runtime', enable_websockets=False, log_level="warn" diff --git a/frameworks/Python/granian/requirements.txt b/frameworks/Python/granian/requirements.txt index 75e49987e80..e1b7c479119 100644 --- a/frameworks/Python/granian/requirements.txt +++ b/frameworks/Python/granian/requirements.txt @@ -1,4 +1,4 @@ asyncpg==0.29.0 -granian>=1.3.1,<1.4.0 +granian>=1.4.2,<1.5.0 jinja2==3.1.4 orjson==3.10.2 diff --git a/frameworks/Python/granian/run.py b/frameworks/Python/granian/run.py index 82e785e5406..acdad59a542 100644 --- a/frameworks/Python/granian/run.py +++ b/frameworks/Python/granian/run.py @@ -10,7 +10,6 @@ workers = multiprocessing.cpu_count() if threading_mode == "workers": workers = round(workers / 2) - threads = 1 Granian( f"app_{interface}:main", @@ -18,8 +17,8 @@ port=8080, workers=workers, threading_mode=threading_mode, - threads=threads, - backlog=2048, + blocking_threads=1, + backlog=16384, interface=interface, http="1", websockets=False From 48316c28bbd582e6eed10b39f74b743f3b2d00cf Mon Sep 17 00:00:00 2001 From: Chrislearn Young Date: Wed, 12 Jun 2024 04:14:33 +0800 Subject: [PATCH 27/45] [salvo] Update to version 0.68 (#9110) * [salvo] Update to version 0.68 * cargo fmt * ok --- frameworks/Rust/salvo/Cargo.toml | 9 ++--- frameworks/Rust/salvo/salvo-diesel.dockerfile | 2 +- frameworks/Rust/salvo/salvo-lru.dockerfile | 2 +- .../Rust/salvo/salvo-mongo-raw.dockerfile | 2 +- frameworks/Rust/salvo/salvo-mongo.dockerfile | 2 +- .../Rust/salvo/salvo-pg-pool.dockerfile | 2 +- frameworks/Rust/salvo/salvo-pg.dockerfile | 2 +- frameworks/Rust/salvo/salvo-sqlx.dockerfile | 2 +- frameworks/Rust/salvo/salvo.dockerfile | 2 +- frameworks/Rust/salvo/src/db_pg_pool.rs | 3 +- frameworks/Rust/salvo/src/db_sqlx.rs | 2 +- frameworks/Rust/salvo/src/main.rs | 25 +++++++++++-- frameworks/Rust/salvo/src/main_diesel.rs | 14 +++---- frameworks/Rust/salvo/src/main_mongo.rs | 5 ++- frameworks/Rust/salvo/src/main_pg.rs | 37 ++++--------------- frameworks/Rust/salvo/src/main_pg_pool.rs | 9 +++-- frameworks/Rust/salvo/src/main_sqlx.rs | 7 +++- 17 files changed, 64 insertions(+), 63 deletions(-) diff --git a/frameworks/Rust/salvo/Cargo.toml b/frameworks/Rust/salvo/Cargo.toml index 0ac4ec76ee3..a7795fc6636 100644 --- a/frameworks/Rust/salvo/Cargo.toml +++ b/frameworks/Rust/salvo/Cargo.toml @@ -40,8 +40,8 @@ anyhow = "1" async-trait = "0.1" bytes = "1" diesel = { version = "2", features = ["postgres", "r2d2"] } -deadpool = { version = "0.11", features = ["rt_tokio_1", "serde", "managed"] } -deadpool-postgres = "0.13" +deadpool = { version = "0.12", features = ["rt_tokio_1", "serde", "managed"] } +deadpool-postgres = "0.14" futures-util = "0.3" lru = "0.12.0" markup = "0.15" @@ -49,7 +49,7 @@ markup = "0.15" mongodb = { version = "2.4.0", features = ["zstd-compression", "snappy-compression", "zlib-compression"] } once_cell = "1" rand = { version = "0.8", features = ["min_const_gen", "small_rng"] } -salvo = { version = "0.67", default-features = false, features = ["anyhow", "server", "http1", "affix"] } +salvo = { version = "0.68", default-features = false, features = ["anyhow", "server", "http1", "affix"] } serde = { version = "1", features = ["derive"] } serde_json = "1" # smallvec = "1" @@ -64,7 +64,4 @@ dotenv = "0.15.0" [profile.release] lto = true -opt-level = 3 codegen-units = 1 -panic = "abort" - diff --git a/frameworks/Rust/salvo/salvo-diesel.dockerfile b/frameworks/Rust/salvo/salvo-diesel.dockerfile index a0bb3a12d8d..1577e454443 100644 --- a/frameworks/Rust/salvo/salvo-diesel.dockerfile +++ b/frameworks/Rust/salvo/salvo-diesel.dockerfile @@ -1,4 +1,4 @@ -FROM rust:1.77 +FROM rust:1.78-buster ENV TECHEMPOWER_POSTGRES_URL=postgres://benchmarkdbuser:benchmarkdbpass@tfb-database/hello_world ENV TECHEMPOWER_MAX_POOL_SIZE=28 diff --git a/frameworks/Rust/salvo/salvo-lru.dockerfile b/frameworks/Rust/salvo/salvo-lru.dockerfile index f209991e939..5f668adaf76 100644 --- a/frameworks/Rust/salvo/salvo-lru.dockerfile +++ b/frameworks/Rust/salvo/salvo-lru.dockerfile @@ -1,4 +1,4 @@ -FROM rust:1.77 +FROM rust:1.78-buster ENV TECHEMPOWER_POSTGRES_URL=postgres://benchmarkdbuser:benchmarkdbpass@tfb-database/hello_world diff --git a/frameworks/Rust/salvo/salvo-mongo-raw.dockerfile b/frameworks/Rust/salvo/salvo-mongo-raw.dockerfile index 4219a6534c6..2fb904eb558 100644 --- a/frameworks/Rust/salvo/salvo-mongo-raw.dockerfile +++ b/frameworks/Rust/salvo/salvo-mongo-raw.dockerfile @@ -1,4 +1,4 @@ -FROM rust:1.77 +FROM rust:1.78-buster ENV TECHEMPOWER_MONGODB_URL=mongodb://tfb-database:27017 ENV TECHEMPOWER_MAX_POOL_SIZE=28 diff --git a/frameworks/Rust/salvo/salvo-mongo.dockerfile b/frameworks/Rust/salvo/salvo-mongo.dockerfile index caac03db963..e8a454910c1 100644 --- a/frameworks/Rust/salvo/salvo-mongo.dockerfile +++ b/frameworks/Rust/salvo/salvo-mongo.dockerfile @@ -1,4 +1,4 @@ -FROM rust:1.77 +FROM rust:1.78-buster ENV TECHEMPOWER_MONGODB_URL=mongodb://tfb-database:27017 ENV TECHEMPOWER_MAX_POOL_SIZE=28 diff --git a/frameworks/Rust/salvo/salvo-pg-pool.dockerfile b/frameworks/Rust/salvo/salvo-pg-pool.dockerfile index 13628c45050..8ef7fc1eeda 100644 --- a/frameworks/Rust/salvo/salvo-pg-pool.dockerfile +++ b/frameworks/Rust/salvo/salvo-pg-pool.dockerfile @@ -1,4 +1,4 @@ -FROM rust:1.77 +FROM rust:1.78-buster ENV TECHEMPOWER_POSTGRES_URL=postgres://benchmarkdbuser:benchmarkdbpass@tfb-database/hello_world ENV TECHEMPOWER_MAX_POOL_SIZE=28 diff --git a/frameworks/Rust/salvo/salvo-pg.dockerfile b/frameworks/Rust/salvo/salvo-pg.dockerfile index 0b5c075fb63..70deda13cd6 100644 --- a/frameworks/Rust/salvo/salvo-pg.dockerfile +++ b/frameworks/Rust/salvo/salvo-pg.dockerfile @@ -1,4 +1,4 @@ -FROM rust:1.77 +FROM rust:1.78-buster ENV TECHEMPOWER_POSTGRES_URL=postgres://benchmarkdbuser:benchmarkdbpass@tfb-database/hello_world diff --git a/frameworks/Rust/salvo/salvo-sqlx.dockerfile b/frameworks/Rust/salvo/salvo-sqlx.dockerfile index 5866030195a..7d88a5d20d9 100644 --- a/frameworks/Rust/salvo/salvo-sqlx.dockerfile +++ b/frameworks/Rust/salvo/salvo-sqlx.dockerfile @@ -1,4 +1,4 @@ -FROM rust:1.77 +FROM rust:1.78-buster ENV TECHEMPOWER_POSTGRES_URL=postgres://benchmarkdbuser:benchmarkdbpass@tfb-database/hello_world ENV TECHEMPOWER_MAX_POOL_SIZE=56 diff --git a/frameworks/Rust/salvo/salvo.dockerfile b/frameworks/Rust/salvo/salvo.dockerfile index b0d748a60ab..8f0d750dcee 100644 --- a/frameworks/Rust/salvo/salvo.dockerfile +++ b/frameworks/Rust/salvo/salvo.dockerfile @@ -1,4 +1,4 @@ -FROM rust:1.77 +FROM rust:1.78-buster ADD ./ /salvo WORKDIR /salvo diff --git a/frameworks/Rust/salvo/src/db_pg_pool.rs b/frameworks/Rust/salvo/src/db_pg_pool.rs index bc1f546e922..064dc34cdae 100644 --- a/frameworks/Rust/salvo/src/db_pg_pool.rs +++ b/frameworks/Rust/salvo/src/db_pg_pool.rs @@ -1,10 +1,9 @@ use deadpool_postgres::{Client, Manager, ManagerConfig, RecyclingMethod}; use tokio_pg_mapper::FromTokioPostgresRow; -use tokio_postgres::{NoTls, Row, Error, Statement}; +use tokio_postgres::{Error, NoTls, Row, Statement}; use crate::{Fortune, World}; - pub async fn create_pool(database_url: String, max_pool_size: u32) -> deadpool_postgres::Pool { let pg_config: tokio_postgres::Config = database_url.parse().expect("invalid database url"); diff --git a/frameworks/Rust/salvo/src/db_sqlx.rs b/frameworks/Rust/salvo/src/db_sqlx.rs index 64ab3696da8..73e5f82afe3 100644 --- a/frameworks/Rust/salvo/src/db_sqlx.rs +++ b/frameworks/Rust/salvo/src/db_sqlx.rs @@ -1,7 +1,7 @@ use sqlx::{ pool::PoolConnection, postgres::{PgArguments, PgPoolOptions}, - Arguments, PgPool, Postgres, Error + Arguments, Error, PgPool, Postgres, }; use crate::{Fortune, World}; diff --git a/frameworks/Rust/salvo/src/main.rs b/frameworks/Rust/salvo/src/main.rs index 1326a09b57c..63e2ca12cd2 100644 --- a/frameworks/Rust/salvo/src/main.rs +++ b/frameworks/Rust/salvo/src/main.rs @@ -2,8 +2,10 @@ // static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc; use std::sync::Arc; +use std::thread::available_parallelism; use bytes::Bytes; +use salvo::conn::tcp::TcpAcceptor; use salvo::http::body::ResBody; use salvo::http::header::{self, HeaderValue}; use salvo::prelude::*; @@ -11,6 +13,7 @@ use serde::Serialize; mod utils; + #[derive(Serialize)] pub struct Message { pub message: &'static str, @@ -35,8 +38,7 @@ fn plaintext(res: &mut Response) { headers.insert(header::CONTENT_TYPE, HeaderValue::from_static("text/plain")); res.body(ResBody::Once(Bytes::from_static(b"Hello, world!"))); } -#[tokio::main] -async + fn main() { let router = Arc::new( Router::new() @@ -44,13 +46,28 @@ fn main() { .push(Router::with_path("json").get(json)), ); + let thread_count = available_parallelism().map(|n| n.get()).unwrap_or(16); + let rt = tokio::runtime::Builder::new_current_thread() + .enable_all() + .build() + .unwrap(); + for _ in 1..thread_count { + let router = router.clone(); + std::thread::spawn(move || { + let rt = tokio::runtime::Builder::new_current_thread() + .enable_all() + .build() + .unwrap(); + rt.block_on(serve(router)); + }); + } println!("Started http server: 127.0.0.1:8080"); - serve(router).await; + rt.block_on(serve(router)); } async fn serve(router: Arc) { // let acceptor: TcpAcceptor = utils::reuse_listener().unwrap().try_into().unwrap(); - let acceptor = TcpListener::new("0.0.0.0:8080").bind().await; + let acceptor: TcpAcceptor = utils::reuse_listener().unwrap().try_into().unwrap(); let mut server = Server::new(acceptor); let http1 = server.http1_mut(); http1.pipeline_flush(true); diff --git a/frameworks/Rust/salvo/src/main_diesel.rs b/frameworks/Rust/salvo/src/main_diesel.rs index 063b814e191..7e2e9f8b36a 100644 --- a/frameworks/Rust/salvo/src/main_diesel.rs +++ b/frameworks/Rust/salvo/src/main_diesel.rs @@ -15,6 +15,7 @@ use std::thread::available_parallelism; use anyhow::Error; use diesel::prelude::*; use diesel::r2d2::{ConnectionManager, Pool, PoolError, PooledConnection}; +use dotenv::dotenv; use once_cell::sync::OnceCell; use rand::rngs::SmallRng; use rand::{Rng, SeedableRng}; @@ -22,7 +23,6 @@ use salvo::conn::tcp::TcpAcceptor; use salvo::http::header::{self, HeaderValue}; use salvo::http::ResBody; use salvo::prelude::*; -use dotenv::dotenv; mod models_diesel; mod schema; @@ -135,7 +135,10 @@ async fn fortunes(res: &mut Response) -> Result<(), Error> { let headers = res.headers_mut(); headers.insert(header::SERVER, HeaderValue::from_static("salvo")); - headers.insert(header::CONTENT_TYPE, HeaderValue::from_static("text/html; charset=utf-8")); + headers.insert( + header::CONTENT_TYPE, + HeaderValue::from_static("text/html; charset=utf-8"), + ); res.body(ResBody::Once(Bytes::from(data))); Ok(()) } @@ -164,14 +167,11 @@ markup::define! { fn main() { dotenv().ok(); - + let db_url: String = utils::get_env_var("TECHEMPOWER_POSTGRES_URL"); let max_pool_size: u32 = utils::get_env_var("TECHEMPOWER_MAX_POOL_SIZE"); DB_POOL - .set( - create_pool(&db_url, max_pool_size) - .unwrap_or_else(|_| panic!("Error connecting to {}", &db_url)), - ) + .set(create_pool(&db_url, max_pool_size).unwrap_or_else(|_| panic!("Error connecting to {}", &db_url))) .ok(); let router = Arc::new( diff --git a/frameworks/Rust/salvo/src/main_mongo.rs b/frameworks/Rust/salvo/src/main_mongo.rs index 46db9bf847c..372fc5bd7b8 100644 --- a/frameworks/Rust/salvo/src/main_mongo.rs +++ b/frameworks/Rust/salvo/src/main_mongo.rs @@ -102,7 +102,10 @@ async fn fortunes(res: &mut Response, depot: &mut Depot) -> Result<(), Error> { let headers = res.headers_mut(); headers.insert(header::SERVER, HeaderValue::from_static("salvo")); - headers.insert(header::CONTENT_TYPE, HeaderValue::from_static("text/html; charset=utf-8")); + headers.insert( + header::CONTENT_TYPE, + HeaderValue::from_static("text/html; charset=utf-8"), + ); res.body(ResBody::Once(Bytes::from(data))); Ok(()) } diff --git a/frameworks/Rust/salvo/src/main_pg.rs b/frameworks/Rust/salvo/src/main_pg.rs index 0d54a192004..dfa6be4ef9f 100644 --- a/frameworks/Rust/salvo/src/main_pg.rs +++ b/frameworks/Rust/salvo/src/main_pg.rs @@ -36,13 +36,7 @@ impl WorldHandler { } #[async_trait] impl Handler for WorldHandler { - async fn handle( - &self, - _req: &mut Request, - _depot: &mut Depot, - res: &mut Response, - _ctrl: &mut FlowCtrl, - ) { + async fn handle(&self, _req: &mut Request, _depot: &mut Depot, res: &mut Response, _ctrl: &mut FlowCtrl) { let world = self.conn.get_world().await.unwrap(); let data = serde_json::to_vec(&world).unwrap(); let headers = res.headers_mut(); @@ -66,13 +60,7 @@ impl WorldsHandler { } #[async_trait] impl Handler for WorldsHandler { - async fn handle( - &self, - req: &mut Request, - _depot: &mut Depot, - res: &mut Response, - _ctrl: &mut FlowCtrl, - ) { + async fn handle(&self, req: &mut Request, _depot: &mut Depot, res: &mut Response, _ctrl: &mut FlowCtrl) { let count = req.query::("q").unwrap_or(1); let count = cmp::min(500, cmp::max(1, count)); let worlds = self.conn.get_worlds(count).await.unwrap(); @@ -99,13 +87,7 @@ impl UpdatesHandler { } #[async_trait] impl Handler for UpdatesHandler { - async fn handle( - &self, - req: &mut Request, - _depot: &mut Depot, - res: &mut Response, - _ctrl: &mut FlowCtrl, - ) { + async fn handle(&self, req: &mut Request, _depot: &mut Depot, res: &mut Response, _ctrl: &mut FlowCtrl) { let count = req.query::("q").unwrap_or(1); let count = cmp::min(500, cmp::max(1, count)); let worlds = self.conn.update(count).await.unwrap(); @@ -132,19 +114,16 @@ impl FortunesHandler { } #[async_trait] impl Handler for FortunesHandler { - async fn handle( - &self, - _req: &mut Request, - _depot: &mut Depot, - res: &mut Response, - _ctrl: &mut FlowCtrl, - ) { + async fn handle(&self, _req: &mut Request, _depot: &mut Depot, res: &mut Response, _ctrl: &mut FlowCtrl) { let mut data = String::new(); write!(&mut data, "{}", self.conn.tell_fortune().await.unwrap()).unwrap(); let headers = res.headers_mut(); headers.insert(header::SERVER, HeaderValue::from_static("salvo")); - headers.insert(header::CONTENT_TYPE, HeaderValue::from_static("text/html; charset=utf-8")); + headers.insert( + header::CONTENT_TYPE, + HeaderValue::from_static("text/html; charset=utf-8"), + ); res.body(ResBody::Once(Bytes::from(data))); } } diff --git a/frameworks/Rust/salvo/src/main_pg_pool.rs b/frameworks/Rust/salvo/src/main_pg_pool.rs index 75078c42ff1..f72f1c64a09 100644 --- a/frameworks/Rust/salvo/src/main_pg_pool.rs +++ b/frameworks/Rust/salvo/src/main_pg_pool.rs @@ -11,6 +11,7 @@ use std::thread::available_parallelism; use anyhow::Error; use bytes::Bytes; use deadpool_postgres::Pool; +use dotenv::dotenv; use futures_util::{stream::FuturesUnordered, TryStreamExt}; use once_cell::sync::OnceCell; use rand::rngs::SmallRng; @@ -19,7 +20,6 @@ use salvo::conn::tcp::TcpAcceptor; use salvo::http::header::{self, HeaderValue}; use salvo::http::ResBody; use salvo::prelude::*; -use dotenv::dotenv; mod db_pg_pool; mod models_pg_pool; @@ -129,7 +129,10 @@ async fn fortunes(res: &mut Response) -> Result<(), Error> { let headers = res.headers_mut(); headers.insert(header::SERVER, HeaderValue::from_static("salvo")); - headers.insert(header::CONTENT_TYPE, HeaderValue::from_static("text/html; charset=utf-8")); + headers.insert( + header::CONTENT_TYPE, + HeaderValue::from_static("text/html; charset=utf-8"), + ); res.body(ResBody::Once(Bytes::from(data))); Ok(()) } @@ -158,7 +161,7 @@ markup::define! { fn main() { dotenv().ok(); - + let db_url: String = utils::get_env_var("TECHEMPOWER_POSTGRES_URL"); let max_pool_size: u32 = utils::get_env_var("TECHEMPOWER_MAX_POOL_SIZE"); let rt = tokio::runtime::Builder::new_current_thread() diff --git a/frameworks/Rust/salvo/src/main_sqlx.rs b/frameworks/Rust/salvo/src/main_sqlx.rs index 2dca03f4e31..6fc8f72c922 100644 --- a/frameworks/Rust/salvo/src/main_sqlx.rs +++ b/frameworks/Rust/salvo/src/main_sqlx.rs @@ -9,6 +9,7 @@ use std::thread::available_parallelism; use anyhow::Error; use bytes::Bytes; +use dotenv::dotenv; use once_cell::sync::OnceCell; use rand::rngs::SmallRng; use rand::{Rng, SeedableRng}; @@ -17,7 +18,6 @@ use salvo::http::header::{self, HeaderValue}; use salvo::http::ResBody; use salvo::prelude::*; use sqlx::PgPool; -use dotenv::dotenv; mod db_sqlx; mod models_sqlx; @@ -62,7 +62,10 @@ async fn fortunes(res: &mut Response) -> Result<(), Error> { let headers = res.headers_mut(); headers.insert(header::SERVER, HeaderValue::from_static("salvo")); - headers.insert(header::CONTENT_TYPE, HeaderValue::from_static("text/html; charset=utf-8")); + headers.insert( + header::CONTENT_TYPE, + HeaderValue::from_static("text/html; charset=utf-8"), + ); res.body(ResBody::Once(Bytes::from(data))); Ok(()) } From a4ac3866e45f3a290b90187a49fc713223fefe80 Mon Sep 17 00:00:00 2001 From: Petrik de Heus Date: Tue, 11 Jun 2024 22:14:52 +0200 Subject: [PATCH 28/45] Remove unmaintained Octopus framework (#9109) The last commit was 6 years ago and according to the about "..this project is no longer actively maintained". https://github.com/LuaMobile/octopus --- frameworks/Lua/octopus/README.md | 35 ------------ frameworks/Lua/octopus/app/config.lua | 16 ------ .../octopus/app/src/FortunesController.lua | 34 ----------- .../app/src/JsonSerializationController.lua | 4 -- .../app/src/MultipleQueriesController.lua | 36 ------------ .../octopus/app/src/PlaintextController.lua | 2 - .../octopus/app/src/SingleQueryController.lua | 24 -------- .../Lua/octopus/app/src/UpdateController.lua | 39 ------------- frameworks/Lua/octopus/app/src/types.lua | 12 ---- frameworks/Lua/octopus/benchmark_config.json | 28 ---------- frameworks/Lua/octopus/config.lua | 39 ------------- frameworks/Lua/octopus/config.toml | 19 ------- frameworks/Lua/octopus/octopus.dockerfile | 56 ------------------- 13 files changed, 344 deletions(-) delete mode 100644 frameworks/Lua/octopus/README.md delete mode 100644 frameworks/Lua/octopus/app/config.lua delete mode 100644 frameworks/Lua/octopus/app/src/FortunesController.lua delete mode 100644 frameworks/Lua/octopus/app/src/JsonSerializationController.lua delete mode 100644 frameworks/Lua/octopus/app/src/MultipleQueriesController.lua delete mode 100644 frameworks/Lua/octopus/app/src/PlaintextController.lua delete mode 100644 frameworks/Lua/octopus/app/src/SingleQueryController.lua delete mode 100644 frameworks/Lua/octopus/app/src/UpdateController.lua delete mode 100644 frameworks/Lua/octopus/app/src/types.lua delete mode 100644 frameworks/Lua/octopus/benchmark_config.json delete mode 100644 frameworks/Lua/octopus/config.lua delete mode 100644 frameworks/Lua/octopus/config.toml delete mode 100644 frameworks/Lua/octopus/octopus.dockerfile diff --git a/frameworks/Lua/octopus/README.md b/frameworks/Lua/octopus/README.md deleted file mode 100644 index 64df0adbd75..00000000000 --- a/frameworks/Lua/octopus/README.md +++ /dev/null @@ -1,35 +0,0 @@ -# Octopus (Nginx + LuaJIT) Benchmark Test - -The test lua app is inside [app](app) directory. -The configuration is in [config.lua](config.lua). -Clones, compiles and runs nginx with ngx_lua module, see [openresty.org](http://openresty.org). -Prerequisites: ```libssl-dev gcc g++ build-essential```. -Requires [git](https://git-scm.com). -Requires postgresql hostname specified as IP address, if not possible then add resolver conf to [config.lua](config.lua). -The Octopus benchmark is using its ORM, and no raw queries. - - -## Test URLs -### Plaintext URL - -http://localhost:8080/plaintext - -### JSON Encoding - -http://localhost:8080/json - -### Single Row Random Query - -http://localhost:8080/db - -### Multiple Row Query Test - -http://localhost:8080/queries?queries=2 - -### Fortune URL - -http://localhost:8080/fortunes - -### DB Updates URL - -http://localhost:8080/update?queries=2 diff --git a/frameworks/Lua/octopus/app/config.lua b/frameworks/Lua/octopus/app/config.lua deleted file mode 100644 index d230c3fafeb..00000000000 --- a/frameworks/Lua/octopus/app/config.lua +++ /dev/null @@ -1,16 +0,0 @@ -local config = {} -- extension configuration - -config.locations = { - {name = "/plaintext", script = "PlaintextController.lua"}, - {name = "/json", script = "JsonSerializationController.lua"}, - {name = "/db", script = "SingleQueryController.lua"}, - {name = "/queries", script = "MultipleQueriesController.lua"}, - {name = "/fortunes", script = "FortunesController.lua"}, - {name = "/update", script = "UpdateController.lua"}, -} - -config.types = { - "types.lua" -} - -return config -- return extension configuration \ No newline at end of file diff --git a/frameworks/Lua/octopus/app/src/FortunesController.lua b/frameworks/Lua/octopus/app/src/FortunesController.lua deleted file mode 100644 index ed3dfd4bfac..00000000000 --- a/frameworks/Lua/octopus/app/src/FortunesController.lua +++ /dev/null @@ -1,34 +0,0 @@ -local json = require "json" -local database = require "database" -local exit = require "exit" - -local template = require'template' -template.caching(false) --- Compile template, disable cache, enable plain text view to skip filesystem loading -local view = template.compile([[Fortunes{% for _,f in ipairs(fortunes) do %}{% end %}
idmessage
{{ f.id }}{{ f.message }}
]], nil, true) - - -local function process (db) - local fortunes = db:find({Fortune = {}}) - table.insert(fortunes, {id = 0, message = "Additional fortune added at request time."}) - table.sort(fortunes, function(a, b) - return a.message < b.message - end) - return fortunes -end - - -local status, db = pcall(database.connect) -if not status then exit(db) end - -local status, res = pcall(process, db) -db:close() - -if status then - local html = view({fortunes = res}) - ngx.header.content_type = 'text/html; charset=utf-8' - ngx.header.content_length = #html - ngx.print(html) -else - exit(res) -end \ No newline at end of file diff --git a/frameworks/Lua/octopus/app/src/JsonSerializationController.lua b/frameworks/Lua/octopus/app/src/JsonSerializationController.lua deleted file mode 100644 index 258a95265e9..00000000000 --- a/frameworks/Lua/octopus/app/src/JsonSerializationController.lua +++ /dev/null @@ -1,4 +0,0 @@ -local json = require "json" - -ngx.header.content_type = 'application/json' -ngx.print(json.encode({message = "Hello, World!"})) \ No newline at end of file diff --git a/frameworks/Lua/octopus/app/src/MultipleQueriesController.lua b/frameworks/Lua/octopus/app/src/MultipleQueriesController.lua deleted file mode 100644 index 0afa4af7640..00000000000 --- a/frameworks/Lua/octopus/app/src/MultipleQueriesController.lua +++ /dev/null @@ -1,36 +0,0 @@ -local json = require "json" -local database = require "database" -local param = require "param" -local exit = require "exit" - - -local function process (db) - local op = db:operators() - - local num_queries = tonumber(param.queries) or 1 - if num_queries < 1 then - num_queries = 1 - elseif num_queries > 500 then - num_queries = 500 - end - - local worlds = {} - for i=1, num_queries do - worlds[#worlds + 1] = db:findOne({World = {id = op.equal(math.random(1,10000))}}) - end - return worlds -end - - -local status, db = pcall(database.connect) -if not status then exit(db) end - -local status, res = pcall(process, db) -db:close() - -if status then - ngx.header.content_type = 'application/json' - ngx.print(json.encode(res)) -else - exit(res) -end \ No newline at end of file diff --git a/frameworks/Lua/octopus/app/src/PlaintextController.lua b/frameworks/Lua/octopus/app/src/PlaintextController.lua deleted file mode 100644 index a5f6fadf29d..00000000000 --- a/frameworks/Lua/octopus/app/src/PlaintextController.lua +++ /dev/null @@ -1,2 +0,0 @@ -ngx.header.content_type = 'text/plain' -ngx.print("Hello, World!") \ No newline at end of file diff --git a/frameworks/Lua/octopus/app/src/SingleQueryController.lua b/frameworks/Lua/octopus/app/src/SingleQueryController.lua deleted file mode 100644 index 1e93e998010..00000000000 --- a/frameworks/Lua/octopus/app/src/SingleQueryController.lua +++ /dev/null @@ -1,24 +0,0 @@ -local json = require "json" -local database = require "database" -local exit = require "exit" - - -local function process (db) - local op = db:operators() - - return db:findOne({World = {id = op.equal(math.random(1,10000))}}) -end - - -local status, db = pcall(database.connect) -if not status then exit(db) end - -local status, res = pcall(process, db) -db:close() - -if status then - ngx.header.content_type = 'application/json' - ngx.print(json.encode(res)) -else - exit(res) -end \ No newline at end of file diff --git a/frameworks/Lua/octopus/app/src/UpdateController.lua b/frameworks/Lua/octopus/app/src/UpdateController.lua deleted file mode 100644 index 8e7c2f9017c..00000000000 --- a/frameworks/Lua/octopus/app/src/UpdateController.lua +++ /dev/null @@ -1,39 +0,0 @@ -local json = require "json" -local database = require "database" -local param = require "param" -local exit = require "exit" - - -local function process (db) - local op = db:operators() - - local num_queries = tonumber(param.queries) or 1 - if num_queries < 1 then - num_queries = 1 - elseif num_queries > 500 then - num_queries = 500 - end - - local worlds = {} - for i=1, num_queries do - local world = db:findOne({World = {id = op.equal(math.random(1,10000))}}) - world.randomNumber = math.random(1,10000) - db:update({World = world}) - worlds[#worlds + 1] = world - end - return worlds -end - - -local status, db = pcall(database.connect) -if not status then exit(db) end - -local status, res = pcall(process, db) -db:close() - -if status then - ngx.header.content_type = 'application/json' - ngx.print(json.encode(res)) -else - exit(res) -end \ No newline at end of file diff --git a/frameworks/Lua/octopus/app/src/types.lua b/frameworks/Lua/octopus/app/src/types.lua deleted file mode 100644 index be7cf95f0d8..00000000000 --- a/frameworks/Lua/octopus/app/src/types.lua +++ /dev/null @@ -1,12 +0,0 @@ -return { - - World = { - -- id field is implicitly defined by the ORM - randomNumber = "integer", - }, - - Fortune = { - -- id field is implicitly defined by the ORM - message = "string", - }, -} \ No newline at end of file diff --git a/frameworks/Lua/octopus/benchmark_config.json b/frameworks/Lua/octopus/benchmark_config.json deleted file mode 100644 index 2f31b882350..00000000000 --- a/frameworks/Lua/octopus/benchmark_config.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "framework": "octopus", - "tests": [{ - "default": { - "plaintext_url": "/plaintext", - "json_url": "/json", - "db_url": "/db", - "query_url": "/queries?queries=", - "fortune_url": "/fortunes", - "update_url": "/update?queries=", - "port": 8080, - "approach": "Realistic", - "classification": "Fullstack", - "database": "MySQL", - "framework": "Octopus", - "language": "Lua", - "orm": "Full", - "platform": "OpenResty", - "webserver": "nginx", - "os": "Linux", - "database_os": "Linux", - "display_name": "Octopus", - "notes": "", - "versus": "openresty", - "tags": ["broken"] - } - }] -} diff --git a/frameworks/Lua/octopus/config.lua b/frameworks/Lua/octopus/config.lua deleted file mode 100644 index 80276c4b277..00000000000 --- a/frameworks/Lua/octopus/config.lua +++ /dev/null @@ -1,39 +0,0 @@ -return { - extensions = { - {octopusExtensionsDir, "core"}, - {octopusExtensionsDir, "baseline"}, - {octopusExtensionsDir, "orm"}, - {octopusExtensionsDir, "app"}, - }, - - octopusExtensionsDir = octopusExtensionsDir, - octopusHostDir = octopusHostDir, - port = 8080, - securePort = 38080, - luaCodeCache = "on", - serverName = "tfb-server", - errorLog = "error_log logs/error.log;", - accessLog = "access_log logs/access.log;", - includeDrop = [[#include drop.conf;]], - maxBodySize = "50k", - minifyJavaScript = false, - minifyCommand = [[java -jar ../yuicompressor-2.4.8.jar %s -o %s]], - - databaseConnection = { - rdbms = "mysql", - host = "DBHOSTNAME", - port = 3306, - database = "hello_world", - user = "benchmarkdbuser", - password = "benchmarkdbpass", - compact = false - }, - - globalParameters = { - octopusHostDir = octopusHostDir, - sourceCtxPath = "", - requireSecurity = false, - sessionTimeout = 3600, - usePreparedStatement = false, - }, -} diff --git a/frameworks/Lua/octopus/config.toml b/frameworks/Lua/octopus/config.toml deleted file mode 100644 index 30b1d7f6cfb..00000000000 --- a/frameworks/Lua/octopus/config.toml +++ /dev/null @@ -1,19 +0,0 @@ -[framework] -name = "octopus" - -[main] -urls.plaintext = "/plaintext" -urls.json = "/json" -urls.db = "/db" -urls.query = "/queries?queries=" -urls.update = "/update?queries=" -urls.fortune = "/fortunes" -approach = "Realistic" -classification = "Fullstack" -database = "MySQL" -database_os = "Linux" -os = "Linux" -orm = "Full" -platform = "OpenResty" -webserver = "nginx" -versus = "openresty" diff --git a/frameworks/Lua/octopus/octopus.dockerfile b/frameworks/Lua/octopus/octopus.dockerfile deleted file mode 100644 index b2c13b02473..00000000000 --- a/frameworks/Lua/octopus/octopus.dockerfile +++ /dev/null @@ -1,56 +0,0 @@ -FROM buildpack-deps:xenial - -ENV LUA_VERSION="5.1" -ENV LUA_MICRO="5" - -RUN apt-get update -yqq && apt-get install -yqq unzip - -RUN wget https://github.com/LuaDist/lua/archive/$LUA_VERSION.$LUA_MICRO.tar.gz -RUN tar xf $LUA_VERSION.$LUA_MICRO.tar.gz - -ENV LUA_HOME=/lua-$LUA_VERSION.$LUA_MICRO - -RUN cd $LUA_HOME && \ - cp src/luaconf.h.orig src/luaconf.h && \ - make linux && \ - cd src && \ - mkdir ../bin ../include ../lib && \ - install -p -m 0755 lua luac ../bin && \ - install -p -m 0644 lua.h luaconf.h lualib.h lauxlib.h ../include && \ - install -p -m 0644 liblua.a ../lib - -ENV LUA=/lua${LUA_VERSION}.${LUA_MICRO} -ENV PATH=${LUA_HOME}/bin:${PATH} -ENV LUA_PATH="./?.lua;./?.lc;$LUA_HOME/share/lua/5.1/?/init.lua;$LUA_HOME/share/lua/5.1/?.lua;$LUA_HOME/lib/lua/5.1/?/init.lua;$LUA_HOME/lib/lua/5.1/?.lua" -ENV LUA_CPATH="./?.lua;./?.lc;$LUA_HOME/share/lua/5.1/?/init.so;$LUA_HOME/share/lua/5.1/?.so;$LUA_HOME/lib/lua/5.1/?/init.so;$LUA_HOME/lib/lua/5.1/?.so" - -WORKDIR /octo - -RUN git clone https://github.com/cyberz-eu/octopus.git - -WORKDIR /octo/octopus -# Dec 8th, 2017 -RUN git checkout 44c7e7ecdfd9e95703e73df85815c0cca4b441e8 - -WORKDIR /octo - -ADD ./ /octo - -RUN cp -avr app octopus/extensions -RUN cp -vf config.lua octopus/extensions - -WORKDIR /octo/octopus/bin/unix - -RUN chmod +x *.sh - -RUN sed -i 's|wget|wget -q|g' server.sh -RUN sed -i 's|-c nginx.conf|-c nginx.conf -g "daemon off;"|g' server.sh - -RUN ./server.sh install -RUN ./server.sh build - -EXPOSE 8080 - -CMD export DBIP=`getent hosts tfb-database | awk '{ print $1 }'` && \ - sed -i "s|DBHOSTNAME|$DBIP|g" /octo/octopus/extensions/build/src/types.lua && \ - ./server.sh start From 8cb1e7641e4ca4da605d3569f961a1ca6b3fe154 Mon Sep 17 00:00:00 2001 From: Petrik de Heus Date: Tue, 11 Jun 2024 22:15:04 +0200 Subject: [PATCH 29/45] Remove unmaintained Colossus framework (#9108) Colossus hasn't been updated for 6 years. A pull request to make it run on Scala 12.3 has been open for 5 years: https://github.com/tumblr/colossus/pull/681 Scala 12.2 is end-of-life: https://endoflife.date/scala --- frameworks/Scala/colossus/README.md | 30 ------------ .../Scala/colossus/benchmark_config.json | 22 --------- frameworks/Scala/colossus/build.sbt | 10 ---- frameworks/Scala/colossus/colossus.dockerfile | 10 ---- frameworks/Scala/colossus/config.toml | 15 ------ .../Scala/colossus/project/build.properties | 1 - frameworks/Scala/colossus/project/plugins.sbt | 1 - .../src/main/scala/example/Main.scala | 49 ------------------- 8 files changed, 138 deletions(-) delete mode 100644 frameworks/Scala/colossus/README.md delete mode 100644 frameworks/Scala/colossus/benchmark_config.json delete mode 100644 frameworks/Scala/colossus/build.sbt delete mode 100644 frameworks/Scala/colossus/colossus.dockerfile delete mode 100644 frameworks/Scala/colossus/config.toml delete mode 100644 frameworks/Scala/colossus/project/build.properties delete mode 100644 frameworks/Scala/colossus/project/plugins.sbt delete mode 100644 frameworks/Scala/colossus/src/main/scala/example/Main.scala diff --git a/frameworks/Scala/colossus/README.md b/frameworks/Scala/colossus/README.md deleted file mode 100644 index 3938b6bedd6..00000000000 --- a/frameworks/Scala/colossus/README.md +++ /dev/null @@ -1,30 +0,0 @@ -#colossus Benchmarking Test - -### JSON Encoding Test - -* [JSON test source](src/main/scala/example/Main.scala) - -### Plaintext Test - -* [JSON test source](src/main/scala/example/Main.scala) - -## Infrastructure Software Versions -The tests were run with: - -* [Java Oracle 1.8.0_25](http://www.oracle.com/technetwork/java/javase) -* [colossus 0.6.1](http://tumblr.github.io/colossus/) - -## Test URLs -### JSON Encoding Test - -http://localhost:9007/json - -### Plaintext Test - -http://localhost:9007/plaintext - -## How to run -sbt 'oneJar' - -java -jar target/scala-2.11/colossus*one-jar.jar - diff --git a/frameworks/Scala/colossus/benchmark_config.json b/frameworks/Scala/colossus/benchmark_config.json deleted file mode 100644 index 3d31adfe363..00000000000 --- a/frameworks/Scala/colossus/benchmark_config.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "framework": "colossus", - "tests": [{ - "default": { - "orm": "Raw", - "database_os": "Linux", - "json_url": "/json", - "plaintext_url": "/plaintext", - "port": 9007, - "approach": "Realistic", - "classification": "Micro", - "database": "None", - "framework": "colossus", - "language": "Scala", - "platform": "Akka", - "webserver": "None", - "os": "Linux", - "display_name": "colossus", - "notes": "" - } - }] -} diff --git a/frameworks/Scala/colossus/build.sbt b/frameworks/Scala/colossus/build.sbt deleted file mode 100644 index 7c435c9b623..00000000000 --- a/frameworks/Scala/colossus/build.sbt +++ /dev/null @@ -1,10 +0,0 @@ -name := """colossus-example""" - -version := "1.0" - -scalaVersion := "2.12.5" - -libraryDependencies ++= Seq( - "com.tumblr" %% "colossus" % "0.11.0", - "com.github.plokhotnyuk.jsoniter-scala" %% "macros" % "0.21.6" -) diff --git a/frameworks/Scala/colossus/colossus.dockerfile b/frameworks/Scala/colossus/colossus.dockerfile deleted file mode 100644 index a8b2a0402b8..00000000000 --- a/frameworks/Scala/colossus/colossus.dockerfile +++ /dev/null @@ -1,10 +0,0 @@ -FROM hseeberger/scala-sbt:8u151-2.12.5-1.1.2 -WORKDIR /colossus -COPY project project -COPY src src -COPY build.sbt build.sbt -RUN sbt assembly -batch - -EXPOSE 9007 - -CMD ["java", "-server", "-Xms1g", "-Xmx1g", "-XX:NewSize=512m", "-XX:MaxNewSize=512m", "-XX:+UseParallelGC", "-XX:+AggressiveOpts", "-XX:+UseNUMA", "-XX:-UseBiasedLocking", "-XX:+AlwaysPreTouch", "-XX:+UseCondCardMark", "-jar", "target/scala-2.12/colossus-example-assembly-1.0.jar"] diff --git a/frameworks/Scala/colossus/config.toml b/frameworks/Scala/colossus/config.toml deleted file mode 100644 index b992b310825..00000000000 --- a/frameworks/Scala/colossus/config.toml +++ /dev/null @@ -1,15 +0,0 @@ -[framework] -name = "colossus" - -[main] -urls.plaintext = "/plaintext" -urls.json = "/json" -approach = "Realistic" -classification = "Micro" -database = "None" -database_os = "Linux" -os = "Linux" -orm = "Raw" -platform = "Akka" -webserver = "None" -versus = "None" diff --git a/frameworks/Scala/colossus/project/build.properties b/frameworks/Scala/colossus/project/build.properties deleted file mode 100644 index 05313438a19..00000000000 --- a/frameworks/Scala/colossus/project/build.properties +++ /dev/null @@ -1 +0,0 @@ -sbt.version=1.1.2 diff --git a/frameworks/Scala/colossus/project/plugins.sbt b/frameworks/Scala/colossus/project/plugins.sbt deleted file mode 100644 index 652a3b93be3..00000000000 --- a/frameworks/Scala/colossus/project/plugins.sbt +++ /dev/null @@ -1 +0,0 @@ -addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.6") diff --git a/frameworks/Scala/colossus/src/main/scala/example/Main.scala b/frameworks/Scala/colossus/src/main/scala/example/Main.scala deleted file mode 100644 index b0ef60b026b..00000000000 --- a/frameworks/Scala/colossus/src/main/scala/example/Main.scala +++ /dev/null @@ -1,49 +0,0 @@ -package example - -import akka.actor.ActorSystem -import colossus.core._ -import colossus.protocols.http._ -import colossus.service._ -import colossus.service.Callback.Implicits._ -import colossus.service.GenRequestHandler.PartialHandler -import colossus.util.DataSize -import com.github.plokhotnyuk.jsoniter_scala.core._ -import com.github.plokhotnyuk.jsoniter_scala.macros._ - -import scala.concurrent.duration.Duration - -case class Message(message: String) - -object Main extends App { - - val serverConfig = ServerSettings( - port = 9007, - maxConnections = 16384, - tcpBacklogSize = Some(1024)) - - val serviceConfig = ServiceConfig( - logErrors = false, - requestMetrics = false, - requestTimeout = Duration("1s"), - requestBufferSize = 65536, - maxRequestSize = DataSize(1024 * 1024)) - - implicit val actorSystem: ActorSystem = ActorSystem() - implicit val ioSystem: IOSystem = IOSystem() - - implicit val codec: JsonValueCodec[Message] = JsonCodecMaker.make[Message](CodecMakerConfig()) - - implicit val messageEncoder: HttpBodyEncoder[Message] = new HttpBodyEncoder[Message] { - override def encode(data: Message): HttpBody = new HttpBody(writeToArray(data)) - override def contentType: String = "application/json" - } - - HttpServer.start("Colossus", serverConfig)(initContext => new Initializer(initContext) { - override def onConnect: RequestHandlerFactory = serverContext => new RequestHandler(serverContext, serviceConfig) { - override def handle: PartialHandler[Http] = { - case req if req.head.url == "/plaintext" => req.ok("Hello, World!") - case req if req.head.url == "/json" => req.ok(Message("Hello, World!")) - } - } - }) -} From f52bb8df8ff8db795b9d97690d3dd2163124f616 Mon Sep 17 00:00:00 2001 From: Petrik de Heus Date: Tue, 11 Jun 2024 22:15:17 +0200 Subject: [PATCH 30/45] Fix link in to Baratine (#9107) baratine.io no longer hosts the framework. --- frameworks/Java/baratine/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frameworks/Java/baratine/README.md b/frameworks/Java/baratine/README.md index ac2a02a2563..6f1616520ce 100644 --- a/frameworks/Java/baratine/README.md +++ b/frameworks/Java/baratine/README.md @@ -13,7 +13,7 @@ This is the Baratine portion of a [benchmarking test suite](../) comparing a var ## Software Versions * [Java OpenJDK 1.8](http://openjdk.java.net/) -* [Baratine 0.11.0](http://baratine.io/) +* [Baratine 0.11.0](https://github.com/baratine/baratine) ## Test URLs From 31a977d345efbed8624978fb521bdb2cdc4acfc0 Mon Sep 17 00:00:00 2001 From: Petrik de Heus Date: Tue, 11 Jun 2024 22:15:25 +0200 Subject: [PATCH 31/45] Remove unmaintained fintrospect framework (#9106) Fintrospect is currently failing and hasn't been updated in 4 years: https://github.com/daviddenton/fintrospect --- frameworks/Scala/fintrospect/.gitignore | 3 - frameworks/Scala/fintrospect/README.md | 22 ------ .../Scala/fintrospect/benchmark_config.json | 29 ------- frameworks/Scala/fintrospect/build.sbt | 25 ------ frameworks/Scala/fintrospect/config.toml | 19 ----- .../Scala/fintrospect/fintrospect.dockerfile | 10 --- .../fintrospect/project/build.properties | 1 - .../Scala/fintrospect/project/plugins.sbt | 1 - .../src/main/resources/FortunesList.mustache | 1 - .../fintrospect/src/main/scala/Database.scala | 22 ------ .../src/main/scala/DatabaseRoutes.scala | 77 ------------------- .../scala/FintrospectBenchmarkServer.scala | 36 --------- .../src/main/scala/FortunesRoute.scala | 41 ---------- .../src/main/scala/JsonRoute.scala | 13 ---- .../src/main/scala/PlainTextRoute.scala | 15 ---- 15 files changed, 315 deletions(-) delete mode 100644 frameworks/Scala/fintrospect/.gitignore delete mode 100644 frameworks/Scala/fintrospect/README.md delete mode 100644 frameworks/Scala/fintrospect/benchmark_config.json delete mode 100644 frameworks/Scala/fintrospect/build.sbt delete mode 100644 frameworks/Scala/fintrospect/config.toml delete mode 100644 frameworks/Scala/fintrospect/fintrospect.dockerfile delete mode 100644 frameworks/Scala/fintrospect/project/build.properties delete mode 100644 frameworks/Scala/fintrospect/project/plugins.sbt delete mode 100644 frameworks/Scala/fintrospect/src/main/resources/FortunesList.mustache delete mode 100644 frameworks/Scala/fintrospect/src/main/scala/Database.scala delete mode 100644 frameworks/Scala/fintrospect/src/main/scala/DatabaseRoutes.scala delete mode 100644 frameworks/Scala/fintrospect/src/main/scala/FintrospectBenchmarkServer.scala delete mode 100644 frameworks/Scala/fintrospect/src/main/scala/FortunesRoute.scala delete mode 100644 frameworks/Scala/fintrospect/src/main/scala/JsonRoute.scala delete mode 100644 frameworks/Scala/fintrospect/src/main/scala/PlainTextRoute.scala diff --git a/frameworks/Scala/fintrospect/.gitignore b/frameworks/Scala/fintrospect/.gitignore deleted file mode 100644 index f6a61f70454..00000000000 --- a/frameworks/Scala/fintrospect/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -sbt -target/ - diff --git a/frameworks/Scala/fintrospect/README.md b/frameworks/Scala/fintrospect/README.md deleted file mode 100644 index 02810a411ce..00000000000 --- a/frameworks/Scala/fintrospect/README.md +++ /dev/null @@ -1,22 +0,0 @@ -#fintrospect Benchmarking Test - -## Infrastructure Software Versions -The tests were run with: - -* [Java Oracle 1.8.0_25](http://www.oracle.com/technetwork/java/javase) -* [fintrospect 14.15.0](https://github.com/daviddenton/fintrospect) - -## Test URLs - -- JSON Encoding: http://localhost:9000/json -- Plaintext: http://localhost:9000/plaintext -- Fortunes: http://localhost:9000/fortunes -- Single Query: http://localhost:9000/db -- Multi Query: http://localhost:9000/queries?queries=1 -- Update Query: http://localhost:9000/updates?queries=1 - -## How to run -sbt 'oneJar' - -`java -jar target/scala-2.12/*fintrospect*one-jar.jar` - diff --git a/frameworks/Scala/fintrospect/benchmark_config.json b/frameworks/Scala/fintrospect/benchmark_config.json deleted file mode 100644 index 9a5b941d7bf..00000000000 --- a/frameworks/Scala/fintrospect/benchmark_config.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "framework": "fintrospect", - "tests": [ - { - "default": { - "orm": "Raw", - "database_os": "Linux", - "db_url": "/db", - "fortune_url": "/fortunes", - "json_url": "/json", - "query_url": "/queries?queries=", - "plaintext_url": "/plaintext", - "update_url": "/updates?queries=", - "port": 9000, - "approach": "Realistic", - "classification": "Micro", - "database": "MySQL", - "framework": "fintrospect", - "language": "Scala", - "platform": "Netty", - "webserver": "None", - "os": "Linux", - "display_name": "fintrospect", - "notes": "", - "versus": "finagle" - } - } - ] -} \ No newline at end of file diff --git a/frameworks/Scala/fintrospect/build.sbt b/frameworks/Scala/fintrospect/build.sbt deleted file mode 100644 index a7c09556d6d..00000000000 --- a/frameworks/Scala/fintrospect/build.sbt +++ /dev/null @@ -1,25 +0,0 @@ -name := """techempower-benchmarks-fintrospect""" - -version := "1.0" - -scalaVersion := "2.13.3" - -scalacOptions += "-deprecation" - -scalacOptions += "-feature" - -resolvers += "JCenter" at "https://jcenter.bintray.com" - -resolvers += Resolver.sonatypeRepo("snapshots") - -libraryDependencies ++= Seq( - "io.fintrospect" %% "fintrospect-core" % "17.0.0", - "io.fintrospect" %% "fintrospect-jackson" % "17.0.0", - "io.fintrospect" %% "fintrospect-mustache" % "17.0.0", - "com.twitter" %% "finagle-mysql" % "20.8.0" -) - -assemblyMergeStrategy in assembly := { - case PathList("META-INF", xs @ _*) => MergeStrategy.discard - case x => MergeStrategy.first -} diff --git a/frameworks/Scala/fintrospect/config.toml b/frameworks/Scala/fintrospect/config.toml deleted file mode 100644 index 80a2f984dab..00000000000 --- a/frameworks/Scala/fintrospect/config.toml +++ /dev/null @@ -1,19 +0,0 @@ -[framework] -name = "fintrospect" - -[main] -urls.plaintext = "/plaintext" -urls.json = "/json" -urls.db = "/db" -urls.query = "/queries?queries=" -urls.update = "/updates?queries=" -urls.fortune = "/fortunes" -approach = "Realistic" -classification = "Micro" -database = "MySQL" -database_os = "Linux" -os = "Linux" -orm = "Raw" -platform = "Netty" -webserver = "None" -versus = "finagle" diff --git a/frameworks/Scala/fintrospect/fintrospect.dockerfile b/frameworks/Scala/fintrospect/fintrospect.dockerfile deleted file mode 100644 index 26d2f15fca0..00000000000 --- a/frameworks/Scala/fintrospect/fintrospect.dockerfile +++ /dev/null @@ -1,10 +0,0 @@ -FROM hseeberger/scala-sbt:8u222_1.3.5_2.13.1 -WORKDIR /fintrospect -COPY project project -COPY src src -COPY build.sbt build.sbt -RUN sbt assembly -batch - -EXPOSE 9000 - -CMD ["java", "-Dcom.twitter.finagle.toggle.flag.overrides=com.twitter.http.UseNetty4=1.0", "-server", "-XX:+UseNUMA", "-XX:+UseParallelGC", "-XX:+AggressiveOpts", "-XX:+AlwaysPreTouch", "-jar", "target/scala-2.13/techempower-benchmarks-fintrospect-assembly-1.0.jar"] diff --git a/frameworks/Scala/fintrospect/project/build.properties b/frameworks/Scala/fintrospect/project/build.properties deleted file mode 100644 index 0837f7a132d..00000000000 --- a/frameworks/Scala/fintrospect/project/build.properties +++ /dev/null @@ -1 +0,0 @@ -sbt.version=1.3.13 diff --git a/frameworks/Scala/fintrospect/project/plugins.sbt b/frameworks/Scala/fintrospect/project/plugins.sbt deleted file mode 100644 index 652a3b93be3..00000000000 --- a/frameworks/Scala/fintrospect/project/plugins.sbt +++ /dev/null @@ -1 +0,0 @@ -addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.6") diff --git a/frameworks/Scala/fintrospect/src/main/resources/FortunesList.mustache b/frameworks/Scala/fintrospect/src/main/resources/FortunesList.mustache deleted file mode 100644 index cce4d7b0393..00000000000 --- a/frameworks/Scala/fintrospect/src/main/resources/FortunesList.mustache +++ /dev/null @@ -1 +0,0 @@ -Fortunes{{#items}}{{/items}}
idmessage
{{id}}{{message}}
\ No newline at end of file diff --git a/frameworks/Scala/fintrospect/src/main/scala/Database.scala b/frameworks/Scala/fintrospect/src/main/scala/Database.scala deleted file mode 100644 index 8075fe44e31..00000000000 --- a/frameworks/Scala/fintrospect/src/main/scala/Database.scala +++ /dev/null @@ -1,22 +0,0 @@ -import com.twitter.finagle.Mysql -import com.twitter.finagle.client.DefaultPool.Param -import com.twitter.finagle.mysql.Client -import com.twitter.finagle.stats.NullStatsReceiver -import com.twitter.finagle.tracing.NullTracer -import com.twitter.util.Duration.fromSeconds -import com.twitter.util.NullMonitor -import io.fintrospect.configuration.Host - -object Database { - def apply(): Client = { - Mysql.client - .withCredentials("benchmarkdbuser", "benchmarkdbpass") - .withDatabase("hello_world") - .configured(Param(low = 256, high = 256, idleTime = fromSeconds(5 * 60), bufferSize = 0, maxWaiters = Int.MaxValue)) - .withStatsReceiver(NullStatsReceiver) - .withMonitor(NullMonitor) - .withTracer(NullTracer) - .withMaxConcurrentPrepareStatements(256) - .newRichClient("tfb-database:3306") - } -} diff --git a/frameworks/Scala/fintrospect/src/main/scala/DatabaseRoutes.scala b/frameworks/Scala/fintrospect/src/main/scala/DatabaseRoutes.scala deleted file mode 100644 index 1ba864a14ef..00000000000 --- a/frameworks/Scala/fintrospect/src/main/scala/DatabaseRoutes.scala +++ /dev/null @@ -1,77 +0,0 @@ -import com.fasterxml.jackson.databind.JsonNode -import com.twitter.finagle.Service -import com.twitter.finagle.http.Method.Get -import com.twitter.finagle.http.{Request, Response} -import com.twitter.finagle.mysql.Parameter.wrap -import com.twitter.finagle.mysql.{Client, IntValue, Result, ResultSet} -import com.twitter.util.Future.collect -import io.fintrospect.formats.Jackson.JsonFormat.{array, number, obj} -import io.fintrospect.formats.Jackson.ResponseBuilder._ -import io.fintrospect.parameters.{ParameterSpec, Query, StringValidations} -import io.fintrospect.{RouteSpec, ServerRoutes} - -import scala.language.reflectiveCalls -import scala.util.{Random, Try} - -object DatabaseRoutes { - - private val toJson: PartialFunction[Result, Option[JsonNode]] = { - case rs: ResultSet => rs.rows.headOption - .map(row => { - val IntValue(id) = row("id").get - val IntValue(random) = row("randomNumber").get - obj("id" -> number(id), "randomNumber" -> number(random)) - }) - case _ => None - } - - private def generateRandomNumber = Random.nextInt(9999) + 1 - - def apply(database: Client) = { - val getStatement = database.prepare("SELECT id, randomNumber FROM world WHERE id = ?") - val updateStatement = database.prepare("UPDATE world SET randomNumber = ? WHERE id = ?") - - val queryRoute = RouteSpec().at(Get) / "db" bindTo Service.mk { - _: Request => getStatement(generateRandomNumber) - .map(toJson) - .map(_.map(Ok(_)).getOrElse(NotFound("")).build()) - } - - val numberOfQueries = Query.optional(ParameterSpec.string(StringValidations.EmptyIsValid).map { - i => Try(i.toInt).getOrElse(1).max(1).min(500) - }, "queries") - - val multipleRoute = RouteSpec() - .taking(numberOfQueries) - .at(Get) / "queries" bindTo Service.mk { - r: Request => { - collect(1.to((numberOfQueries <-- r).getOrElse(1)) - .map(i => getStatement(generateRandomNumber).map(toJson))) - .map(f => f.flatMap(_.toSeq)) - .flatMap(c => Ok(array(c))) - } - } - - val updateRoute = RouteSpec() - .taking(numberOfQueries) - .at(Get) / "updates" bindTo Service.mk { - r: Request => { - collect(1.to((numberOfQueries <-- r).getOrElse(1)) - .map(i => { - val id = generateRandomNumber - updateStatement(generateRandomNumber, id) - .flatMap(_ => getStatement(id)) - .map(toJson) - })) - .map(f => f.flatMap(_.toSeq)) - .flatMap(c => Ok(array(c))) - } - } - - new ServerRoutes[Request, Response] { - add(queryRoute) - add(multipleRoute) - add(updateRoute) - } - } -} diff --git a/frameworks/Scala/fintrospect/src/main/scala/FintrospectBenchmarkServer.scala b/frameworks/Scala/fintrospect/src/main/scala/FintrospectBenchmarkServer.scala deleted file mode 100644 index bf08266724b..00000000000 --- a/frameworks/Scala/fintrospect/src/main/scala/FintrospectBenchmarkServer.scala +++ /dev/null @@ -1,36 +0,0 @@ -import java.util.TimeZone.getTimeZone - -import com.twitter.finagle.http.path.Root -import com.twitter.finagle.http.{Request, Response} -import com.twitter.finagle.{Filter, Http} -import com.twitter.util.Await -import io.fintrospect.RouteModule -import io.fintrospect.filters.ResponseFilters -import org.apache.commons.lang3.time.FastDateFormat.getInstance - -object FintrospectBenchmarkServer extends App { - - val dateFormat = getInstance("EEE, d MMM yyyy HH:mm:ss 'GMT'", getTimeZone("GMT")) - - val addServerAndDate = Filter.mk[Request, Response, Request, Response] { (req, svc) => - svc(req).map(resp => { - resp.headerMap("Server") = "Example" - resp.headerMap("Date") = dateFormat.format(System.currentTimeMillis()) - resp - }) - } - - val database = Database() - - val module = RouteModule(Root) - .withRoute(JsonRoute()) - .withRoute(PlainTextRoute()) - .withRoute(FortunesRoute(database)) - .withRoutes(DatabaseRoutes(database)) - - Await.ready( - Http.server - .withCompressionLevel(0) - .serve(":9000", ResponseFilters.CatchAll().andThen(addServerAndDate).andThen(module.toService)) - ) -} diff --git a/frameworks/Scala/fintrospect/src/main/scala/FortunesRoute.scala b/frameworks/Scala/fintrospect/src/main/scala/FortunesRoute.scala deleted file mode 100644 index e7d0b858dd6..00000000000 --- a/frameworks/Scala/fintrospect/src/main/scala/FortunesRoute.scala +++ /dev/null @@ -1,41 +0,0 @@ -import com.twitter.finagle.Service -import com.twitter.finagle.http.Method.Get -import com.twitter.finagle.http.Request -import com.twitter.finagle.mysql._ -import io.fintrospect.RouteSpec -import io.fintrospect.formats.Html -import io.fintrospect.templating.MustacheTemplates.CachingClasspath -import io.fintrospect.templating.{RenderView, View} - -case class Fortune(id: Int, message: String) - -case class FortunesList(items: Seq[Fortune]) extends View - -object FortunesRoute { - - private val toFortunes: PartialFunction[Result, Seq[Fortune]] = { - case rs: ResultSet => rs.rows - .map(row => { - val IntValue(id) = row("id").get - val StringValue(message) = row("message").get - Fortune(id, message) - }) - case _ => Seq.empty - } - - def apply(database: Client) = { - - val statement = database.prepare("SELECT * FROM fortune") - - val service = new RenderView(Html.ResponseBuilder, CachingClasspath()).andThen( - Service.mk { - _: Request => - statement().map(toFortunes).map(f => { - val sortedFortunes = (Fortune(0, "Additional fortune added at request time.") +: f).sortBy(_.message) - FortunesList(sortedFortunes) - }) - }) - - RouteSpec().at(Get) / "fortunes" bindTo service - } -} diff --git a/frameworks/Scala/fintrospect/src/main/scala/JsonRoute.scala b/frameworks/Scala/fintrospect/src/main/scala/JsonRoute.scala deleted file mode 100644 index e3bb2311891..00000000000 --- a/frameworks/Scala/fintrospect/src/main/scala/JsonRoute.scala +++ /dev/null @@ -1,13 +0,0 @@ -import com.twitter.finagle.Service -import com.twitter.finagle.http.Method.Get -import com.twitter.finagle.http.Request -import io.fintrospect.RouteSpec -import io.fintrospect.formats.Jackson.JsonFormat.{encodeToBuf, obj, string} -import io.fintrospect.formats.Jackson.ResponseBuilder._ - -object JsonRoute { - - private val service = Service.mk { _: Request => Ok(encodeToBuf(obj("message" -> string("Hello, World!")))) } - - def apply() = RouteSpec().at(Get) / "json" bindTo service -} diff --git a/frameworks/Scala/fintrospect/src/main/scala/PlainTextRoute.scala b/frameworks/Scala/fintrospect/src/main/scala/PlainTextRoute.scala deleted file mode 100644 index a2c5b6198d1..00000000000 --- a/frameworks/Scala/fintrospect/src/main/scala/PlainTextRoute.scala +++ /dev/null @@ -1,15 +0,0 @@ -import com.twitter.finagle.Service -import com.twitter.finagle.http.Method.Get -import com.twitter.finagle.http.Request -import com.twitter.io.Buf -import io.fintrospect.RouteSpec -import io.fintrospect.formats.PlainText.ResponseBuilder._ - -object PlainTextRoute { - - private val preallocatedMsgForPlainText = Buf.Utf8("Hello, World!") - - private val service = Service.mk { _: Request => Ok(preallocatedMsgForPlainText) } - - def apply() = RouteSpec().at(Get) / "plaintext" bindTo service -} From 5dbaa7ef536357326c356641ec8ecfaddde7b62e Mon Sep 17 00:00:00 2001 From: Petrik de Heus Date: Tue, 11 Jun 2024 22:15:40 +0200 Subject: [PATCH 32/45] Remove unmaintained comsat framework (#9105) Comsat is currently failing and hasn't been updated for 8 years: https://github.com/puniverse/comsat --- frameworks/Java/comsat/README.md | 39 ------- frameworks/Java/comsat/benchmark_config.json | 83 -------------- frameworks/Java/comsat/build.gradle | 100 ----------------- .../comsat/comsat-servlet-undertow.dockerfile | 14 --- .../comsat/comsat-webactors-netty.dockerfile | 14 --- .../comsat-webactors-undertow.dockerfile | 14 --- frameworks/Java/comsat/comsat.dockerfile | 14 --- frameworks/Java/comsat/config.toml | 54 ---------- .../comsat/src/main/java/hello/Server.java | 6 -- .../comsat/src/main/java/hello/World.java | 10 -- .../main/java/hello/servlet/JettyServer.java | 46 -------- .../main/java/hello/servlet/JsonServlet.java | 30 ------ .../java/hello/servlet/PlaintextServlet.java | 24 ----- .../java/hello/servlet/UndertowServer.java | 101 ------------------ .../java/hello/webactors/NettyServer.java | 68 ------------ .../java/hello/webactors/UndertowServer.java | 57 ---------- .../main/java/hello/webactors/WebActor.java | 57 ---------- 17 files changed, 731 deletions(-) delete mode 100644 frameworks/Java/comsat/README.md delete mode 100644 frameworks/Java/comsat/benchmark_config.json delete mode 100644 frameworks/Java/comsat/build.gradle delete mode 100644 frameworks/Java/comsat/comsat-servlet-undertow.dockerfile delete mode 100644 frameworks/Java/comsat/comsat-webactors-netty.dockerfile delete mode 100644 frameworks/Java/comsat/comsat-webactors-undertow.dockerfile delete mode 100644 frameworks/Java/comsat/comsat.dockerfile delete mode 100644 frameworks/Java/comsat/config.toml delete mode 100644 frameworks/Java/comsat/src/main/java/hello/Server.java delete mode 100644 frameworks/Java/comsat/src/main/java/hello/World.java delete mode 100644 frameworks/Java/comsat/src/main/java/hello/servlet/JettyServer.java delete mode 100644 frameworks/Java/comsat/src/main/java/hello/servlet/JsonServlet.java delete mode 100644 frameworks/Java/comsat/src/main/java/hello/servlet/PlaintextServlet.java delete mode 100644 frameworks/Java/comsat/src/main/java/hello/servlet/UndertowServer.java delete mode 100644 frameworks/Java/comsat/src/main/java/hello/webactors/NettyServer.java delete mode 100644 frameworks/Java/comsat/src/main/java/hello/webactors/UndertowServer.java delete mode 100644 frameworks/Java/comsat/src/main/java/hello/webactors/WebActor.java diff --git a/frameworks/Java/comsat/README.md b/frameworks/Java/comsat/README.md deleted file mode 100644 index d30c5cdd7d4..00000000000 --- a/frameworks/Java/comsat/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# Parallel Universe Comsat Benchmarking Test - -This is the [Parallel Universe Comsat](http://docs.paralleluniverse.co/comsat/#overview) version of a [benchmarking test suite](../) comparing a variety of web development platforms. It serves requests in lightweight [Quasar fibers](http://docs.paralleluniverse.co/quasar/#fibers) rather than heavyweight Java threads. There are two main flavors: Comsat Servlet and Comsat Web Actors. - -## Comsat Servlet - -[Parallel Universe Comsat Servlet](http://docs.paralleluniverse.co/comsat/#servlets) works with any servlet containers (tests are run against embedded Undertow and Jetty). - -### JSON Encoding and Plaintext Tests - -* [JSON test source](src/main/java/hello/servlet/JsonServlet.java) -* [Plaintext test source](src/main/java/hello/servlet/PlaintextServlet.java) - -## Comsat Web Actors - -[Parallel Universe Comsat Web Actors](http://docs.paralleluniverse.co/comsat/#web-actors) runs as an Undertow or Netty handler. - -### JSON and Plaintest Encoding Tests - -* [JSON test source](src/main/java/hello/webactors/HelloWebActor.java) - -## Versions - -* Jackson JSON 2.7.4 (https://github.com/FasterXML/jackson) -* Quasar 0.7.5 (http://docs.paralleluniverse.co/quasar) -* Comsat 0.7.0 (http://docs.paralleluniverse.co/comsat) -* Jetty 9.3.9.v20160517 (https://www.eclipse.org/jetty/) -* Netty 4.0.36.Final (http://netty.io/) -* Undertow 1.3.22-final (http://undertow.io) - -## Test URLs - -### JSON Encoding Test - - http://localhost:8080/json - -### Plaintest - - http://localhost:8080/plaintest diff --git a/frameworks/Java/comsat/benchmark_config.json b/frameworks/Java/comsat/benchmark_config.json deleted file mode 100644 index e6c79e87238..00000000000 --- a/frameworks/Java/comsat/benchmark_config.json +++ /dev/null @@ -1,83 +0,0 @@ -{ - "framework": "comsat", - "tests": [ - { - "default": { - "json_url": "/json", - "plaintext_url": "/plaintext", - "port": 8080, - "approach": "Realistic", - "classification": "Platform", - "database": "None", - "framework": "None", - "language": "Java", - "flavor": "None", - "orm": "Raw", - "platform": "Servlet", - "webserver": "None", - "os": "Linux", - "database_os": "Linux", - "display_name": "comsat-servlet-jetty", - "notes": "Comsat servlet on embedded Jetty", - "versus": "" - }, - "servlet-undertow": { - "json_url": "/json", - "plaintext_url": "/plaintext", - "port": 8080, - "approach": "Realistic", - "classification": "Platform", - "database": "None", - "framework": "None", - "language": "Java", - "flavor": "None", - "orm": "Raw", - "platform": "Servlet", - "webserver": "None", - "os": "Linux", - "database_os": "Linux", - "display_name": "Comsat", - "notes": "Comsat servlet on embedded Undertow", - "versus": "comsat" - }, - "webactors-netty": { - "json_url": "/json", - "plaintext_url": "/plaintext", - "port": 8080, - "approach": "Realistic", - "classification": "Platform", - "database": "None", - "framework": "None", - "language": "Java", - "flavor": "None", - "orm": "Raw", - "platform": "Comsat", - "webserver": "None", - "os": "Linux", - "database_os": "Linux", - "display_name": "Comsat", - "notes": "Comsat Web Actors run as Netty handler", - "versus": "" - }, - "webactors-undertow": { - "json_url": "/json", - "plaintext_url": "/plaintext", - "port": 8080, - "approach": "Realistic", - "classification": "Platform", - "database": "None", - "framework": "None", - "language": "Java", - "flavor": "None", - "orm": "Raw", - "platform": "Comsat", - "webserver": "None", - "os": "Linux", - "database_os": "Linux", - "display_name": "Comsat", - "notes": "Comsat Web Actors run as Undertow handler", - "versus": "comsat-webactors-netty" - } - } - ] -} diff --git a/frameworks/Java/comsat/build.gradle b/frameworks/Java/comsat/build.gradle deleted file mode 100644 index 89bc28d3dc5..00000000000 --- a/frameworks/Java/comsat/build.gradle +++ /dev/null @@ -1,100 +0,0 @@ -// Capsule plugin -plugins { - id "us.kirchmeier.capsule" version "1.0.2" -} - -apply plugin: 'java' - -sourceCompatibility = 1.8 -targetCompatibility = 1.8 - -version = '0.3' - -ext.jacksonVer = '2.9.9' -ext.quasarVer = '0.7.5' -ext.comsatVer = '0.7.0' -ext.capsuleVer = '1.0.2' - -ext.jettyVer = '9.3.9.v20160517' -ext.undertowVer = '1.3.22.Final' -ext.nettyVer = '4.0.37.Final' - -ext.slf4jVer = '1.7.21' - -[compileJava, compileTestJava]*.options*.encoding = "UTF-8" - -repositories { - mavenCentral() - maven { url 'https://oss.sonatype.org/content/repositories/snapshots' } - // mavenLocal() -} - -configurations { - quasar -} - -configurations.all { - resolutionStrategy { - failOnVersionConflict() - force "org.eclipse.jetty:jetty-util:$jettyVer" - force "org.eclipse.jetty:jetty-io:$jettyVer" - force "org.eclipse.jetty:jetty-http:$jettyVer" - force "org.eclipse.jetty:jetty-server:$jettyVer" - force "org.eclipse.jetty:jetty-servlet:$jettyVer" - force "org.eclipse.jetty:jetty-webapp:$jettyVer" - force "org.eclipse.jetty:jetty-xml:$jettyVer" - force "org.eclipse.jetty.websocket:websocket-server:$jettyVer" - force "org.eclipse.jetty.websocket:websocket-servlet:$jettyVer" - force "org.eclipse.jetty.websocket:websocket-client:$jettyVer" - force "io.undertow:undertow-core:$undertowVer" - force "io.undertow:undertow-servlet:$undertowVer" - force "io.netty:netty-all:$nettyVer" - force "org.slf4j:slf4j-api:$slf4jVer" - force "co.paralleluniverse:quasar-actors:$quasarVer" - } -} - -configurations.capsule.dependencies.clear() - -dependencies { - compile "co.paralleluniverse:quasar-core:$quasarVer:jdk8" - compile "com.fasterxml.jackson.core:jackson-databind:$jacksonVer" - compile "co.paralleluniverse:comsat-servlet:$comsatVer" - compile "co.paralleluniverse:comsat-test-utils:$comsatVer" - compile "co.paralleluniverse:comsat-actors-api:$comsatVer" - compile "co.paralleluniverse:comsat-actors-netty:$comsatVer" - compile "co.paralleluniverse:comsat-actors-undertow:$comsatVer" - compile "co.paralleluniverse:comsat-test-utils:$comsatVer" - - capsule "co.paralleluniverse:capsule:$capsuleVer" - - quasar "co.paralleluniverse:quasar-core:$quasarVer:jdk8" -} - -task capsule(type: FatCapsule) { - applicationClass "hello.World" - - capsuleManifest { - javaAgents = [configurations.quasar.iterator().next().getName()] - - mode('servlet-undertow') { - systemProperties['serverClass'] = 'hello.servlet.UndertowServer' - } - - mode('servlet-jetty') { - systemProperties['serverClass'] = 'hello.servlet.JettyServer' - } - - mode('webactors-netty') { - systemProperties['serverClass'] = 'hello.webactors.NettyServer' - } - - mode('webactors-undertow') { - systemProperties['serverClass'] = 'hello.webactors.UndertowServer' - } - } -} - -task wrapper(type: Wrapper) { - gradleVersion = '2.14' -} diff --git a/frameworks/Java/comsat/comsat-servlet-undertow.dockerfile b/frameworks/Java/comsat/comsat-servlet-undertow.dockerfile deleted file mode 100644 index 75468d15b33..00000000000 --- a/frameworks/Java/comsat/comsat-servlet-undertow.dockerfile +++ /dev/null @@ -1,14 +0,0 @@ -FROM gradle:4.7.0-jdk8 as gradle -USER root -WORKDIR /comsat -COPY build.gradle build.gradle -COPY src src -RUN gradle capsule -q - -FROM openjdk:8-jre-slim -WORKDIR /comsat -COPY --from=gradle /comsat/build/libs/comsat-0.3-capsule.jar app.jar - -EXPOSE 8080 - -CMD ["java", "-Dcapsule.mode=servlet-undertow", "-jar", "app.jar"] diff --git a/frameworks/Java/comsat/comsat-webactors-netty.dockerfile b/frameworks/Java/comsat/comsat-webactors-netty.dockerfile deleted file mode 100644 index 35868380185..00000000000 --- a/frameworks/Java/comsat/comsat-webactors-netty.dockerfile +++ /dev/null @@ -1,14 +0,0 @@ -FROM gradle:4.7.0-jdk8 as gradle -USER root -WORKDIR /comsat -COPY build.gradle build.gradle -COPY src src -RUN gradle capsule -q - -FROM openjdk:8-jre-slim -WORKDIR /comsat -COPY --from=gradle /comsat/build/libs/comsat-0.3-capsule.jar app.jar - -EXPOSE 8080 - -CMD ["java", "-Dcapsule.mode=webactors-netty", "-jar", "app.jar"] diff --git a/frameworks/Java/comsat/comsat-webactors-undertow.dockerfile b/frameworks/Java/comsat/comsat-webactors-undertow.dockerfile deleted file mode 100644 index 482244a4415..00000000000 --- a/frameworks/Java/comsat/comsat-webactors-undertow.dockerfile +++ /dev/null @@ -1,14 +0,0 @@ -FROM gradle:4.7.0-jdk8 as gradle -USER root -WORKDIR /comsat -COPY build.gradle build.gradle -COPY src src -RUN gradle capsule -q - -FROM openjdk:8-jre-slim -WORKDIR /comsat -COPY --from=gradle /comsat/build/libs/comsat-0.3-capsule.jar app.jar - -EXPOSE 8080 - -CMD ["java", "-Dcapsule.mode=webactors-undertow", "-jar", "app.jar"] diff --git a/frameworks/Java/comsat/comsat.dockerfile b/frameworks/Java/comsat/comsat.dockerfile deleted file mode 100644 index d3b4d40cc6b..00000000000 --- a/frameworks/Java/comsat/comsat.dockerfile +++ /dev/null @@ -1,14 +0,0 @@ -FROM gradle:4.7.0-jdk8 as gradle -USER root -WORKDIR /comsat -COPY build.gradle build.gradle -COPY src src -RUN gradle capsule -q - -FROM openjdk:8-jre-slim -WORKDIR /comsat -COPY --from=gradle /comsat/build/libs/comsat-0.3-capsule.jar app.jar - -EXPOSE 8080 - -CMD ["java", "-Dcapsule.mode=servlet-jetty", "-jar", "app.jar"] diff --git a/frameworks/Java/comsat/config.toml b/frameworks/Java/comsat/config.toml deleted file mode 100644 index ab16ef16e3b..00000000000 --- a/frameworks/Java/comsat/config.toml +++ /dev/null @@ -1,54 +0,0 @@ -[framework] -name = "comsat" - -[main] -urls.plaintext = "/plaintext" -urls.json = "/json" -approach = "Realistic" -classification = "Platform" -database = "None" -database_os = "Linux" -os = "Linux" -orm = "Raw" -platform = "Servlet" -webserver = "None" -versus = "" - -[servlet-undertow] -urls.plaintext = "/plaintext" -urls.json = "/json" -approach = "Realistic" -classification = "Platform" -database = "None" -database_os = "Linux" -os = "Linux" -orm = "Raw" -platform = "Servlet" -webserver = "None" -versus = "comsat" - -[webactors-netty] -urls.plaintext = "/plaintext" -urls.json = "/json" -approach = "Realistic" -classification = "Platform" -database = "None" -database_os = "Linux" -os = "Linux" -orm = "Raw" -platform = "Comsat" -webserver = "None" -versus = "" - -[webactors-undertow] -urls.plaintext = "/plaintext" -urls.json = "/json" -approach = "Realistic" -classification = "Platform" -database = "None" -database_os = "Linux" -os = "Linux" -orm = "Raw" -platform = "Comsat" -webserver = "None" -versus = "comsat-webactors-netty" diff --git a/frameworks/Java/comsat/src/main/java/hello/Server.java b/frameworks/Java/comsat/src/main/java/hello/Server.java deleted file mode 100644 index 9b7c04de733..00000000000 --- a/frameworks/Java/comsat/src/main/java/hello/Server.java +++ /dev/null @@ -1,6 +0,0 @@ -package hello; - -@FunctionalInterface -public interface Server { - void run() throws Exception; -} diff --git a/frameworks/Java/comsat/src/main/java/hello/World.java b/frameworks/Java/comsat/src/main/java/hello/World.java deleted file mode 100644 index 22f147b0470..00000000000 --- a/frameworks/Java/comsat/src/main/java/hello/World.java +++ /dev/null @@ -1,10 +0,0 @@ -package hello; - -public final class World { - public static void main(String[] args) throws Exception { - final Server s = (Server) Class.forName(System.getProperty("serverClass", "hello.JettyServer")).newInstance(); - s.run(); - } - - private World() {} -} diff --git a/frameworks/Java/comsat/src/main/java/hello/servlet/JettyServer.java b/frameworks/Java/comsat/src/main/java/hello/servlet/JettyServer.java deleted file mode 100644 index a55985bd8b3..00000000000 --- a/frameworks/Java/comsat/src/main/java/hello/servlet/JettyServer.java +++ /dev/null @@ -1,46 +0,0 @@ -package hello.servlet; - -import hello.Server; -import co.paralleluniverse.embedded.containers.AbstractEmbeddedServer; - -import org.eclipse.jetty.server.ServerConnector; -import org.eclipse.jetty.servlet.ServletContextHandler; -import org.eclipse.jetty.servlet.ServletHolder; -import org.eclipse.jetty.util.thread.QueuedThreadPool; - -/** - * An implementation of the TechEmpower benchmark tests using Comsat servlets and the Jetty servlet container. - */ -public final class JettyServer implements Server { - @Override - public final void run() throws Exception { - final org.eclipse.jetty.server.Server s = new org.eclipse.jetty.server.Server(new QueuedThreadPool(200, Runtime.getRuntime().availableProcessors())); - - final ServerConnector http = new ServerConnector(s); - http.setReuseAddress(true); - http.setAcceptQueueSize(100000); - http.setPort(8080); - s.addConnector(http); - - final ServletContextHandler context = new ServletContextHandler(); - context.setContextPath("/"); - - final ServletHolder holder1 = new ServletHolder(new PlaintextServlet()); - context.addServlet(holder1, "/plaintext"); - holder1.setAsyncSupported(true); - final ServletHolder holder2 = new ServletHolder(new JsonServlet()); - context.addServlet(holder2, "/json"); - holder2.setAsyncSupported(true); - - s.setHandler(context); - - s.start(); - System.err.println("Server is up."); - - AbstractEmbeddedServer.waitUrlAvailable("http://localhost:8080/plaintext"); - AbstractEmbeddedServer.waitUrlAvailable("http://localhost:8080/json"); - System.err.println("Server test cases are instrumented and bootstrapped."); - - s.join(); - } -} diff --git a/frameworks/Java/comsat/src/main/java/hello/servlet/JsonServlet.java b/frameworks/Java/comsat/src/main/java/hello/servlet/JsonServlet.java deleted file mode 100644 index 86cb5957058..00000000000 --- a/frameworks/Java/comsat/src/main/java/hello/servlet/JsonServlet.java +++ /dev/null @@ -1,30 +0,0 @@ -package hello.servlet; - -import co.paralleluniverse.fibers.Suspendable; -import co.paralleluniverse.fibers.servlet.FiberHttpServlet; - -import com.fasterxml.jackson.databind.ObjectMapper; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import java.io.IOException; - -@SuppressWarnings("serial") -public final class JsonServlet extends FiberHttpServlet { - private static final class HelloWorldData { - @SuppressWarnings("unused") - public final String message = "Hello, World!"; - } - - private static final ObjectMapper mapper = new ObjectMapper(); - - @Override - @Suspendable - protected final void doGet(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException { - resp.setContentType("application/json"); - resp.setHeader("Server", "comsat-servlet-undertow"); - mapper.writeValue(resp.getOutputStream(), new HelloWorldData()); - } -} diff --git a/frameworks/Java/comsat/src/main/java/hello/servlet/PlaintextServlet.java b/frameworks/Java/comsat/src/main/java/hello/servlet/PlaintextServlet.java deleted file mode 100644 index d42d4749f03..00000000000 --- a/frameworks/Java/comsat/src/main/java/hello/servlet/PlaintextServlet.java +++ /dev/null @@ -1,24 +0,0 @@ -package hello.servlet; - -import co.paralleluniverse.fibers.Suspendable; -import co.paralleluniverse.fibers.servlet.FiberHttpServlet; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import java.io.IOException; -import java.nio.charset.StandardCharsets; - -@SuppressWarnings("serial") -public final class PlaintextServlet extends FiberHttpServlet { - private static final byte[] helloWorld = "Hello, World!".getBytes(StandardCharsets.ISO_8859_1); - - @Override - @Suspendable - protected final void doGet(final HttpServletRequest req, final HttpServletResponse resp) throws ServletException, IOException { - resp.setContentType("text/plain"); - resp.setHeader("Server", "comsat-servlet-undertow"); - resp.getOutputStream().write(helloWorld); - } -} diff --git a/frameworks/Java/comsat/src/main/java/hello/servlet/UndertowServer.java b/frameworks/Java/comsat/src/main/java/hello/servlet/UndertowServer.java deleted file mode 100644 index 3b14f754015..00000000000 --- a/frameworks/Java/comsat/src/main/java/hello/servlet/UndertowServer.java +++ /dev/null @@ -1,101 +0,0 @@ -package hello.servlet; - -import co.paralleluniverse.embedded.containers.AbstractEmbeddedServer; -import hello.Server; -import io.undertow.Undertow; -import io.undertow.UndertowOptions; -import io.undertow.server.HttpHandler; -import io.undertow.servlet.Servlets; -import io.undertow.servlet.api.DeploymentInfo; -import io.undertow.servlet.api.DeploymentManager; - -import org.xnio.Options; - -import java.io.IOException; - -/** - * An implementation of the TechEmpower benchmark tests using Comsat servlets and the Undertow servlet container. - */ -public final class UndertowServer implements Server { - @Override - public final void run() throws Exception { - final DeploymentInfo deployment = Servlets.deployment().setDeploymentName("") - .setClassLoader(ClassLoader.getSystemClassLoader()) - .setContextPath("/"); - - deployment.addServlet(Servlets.servlet("plaintext", PlaintextServlet.class).addMapping("/plaintext").setAsyncSupported(true)); - deployment.addServlet(Servlets.servlet("json", JsonServlet.class).addMapping("/json").setAsyncSupported(true)); - - final DeploymentManager servletsContainer = Servlets.defaultContainer().addDeployment(deployment); - - servletsContainer.deploy(); - - final HttpHandler handler = servletsContainer.start(); - - //noinspection deprecation - final Undertow server = Undertow.builder() - .setHandler(handler) - .setDirectBuffers(true) - - .setIoThreads(100) - .setWorkerThreads(100) - - .setServerOption(Options.CONNECTION_HIGH_WATER, 100_000) - .setServerOption(Options.CONNECTION_LOW_WATER, 100_000) - - .setBufferSize(1024) - .setBuffersPerRegion(100) - - // .setSocketOption(Options.ALLOW_BLOCKING, true) - .setSocketOption(Options.REUSE_ADDRESSES, true) - // .setSocketOption(Options.CORK, true) - // .setSocketOption(Options.USE_DIRECT_BUFFERS, true) - .setSocketOption(Options.BACKLOG, 100000) - .setSocketOption(Options.TCP_NODELAY, true) - // .setSocketOption(Options.RECEIVE_BUFFER, 2048) - // .setSocketOption(Options.SEND_BUFFER, 2048) - // .setSocketOption(Options.CONNECTION_HIGH_WATER, Integer.MAX_VALUE) - // .setSocketOption(Options.CONNECTION_LOW_WATER, Integer.MAX_VALUE) - // .setSocketOption(Options.READ_TIMEOUT, Integer.MAX_VALUE) - // .setSocketOption(Options.WRITE_TIMEOUT, Integer.MAX_VALUE) - // .setServerOption(UndertowOptions.ALWAYS_SET_KEEP_ALIVE, false) //don't send a keep-alive header for HTTP/1.1 requests, as it is not required - - // .setServerOption(UndertowOptions.ALWAYS_SET_DATE, true) - .setServerOption(UndertowOptions.ENABLE_CONNECTOR_STATISTICS, false) - .setServerOption(UndertowOptions.RECORD_REQUEST_START_TIME, false) - - .addHttpListener(8080, "0.0.0.0") - .build(); - - server.start(); - - System.err.println("Server is up."); - - Runtime.getRuntime().addShutdownHook(new Thread() { - @Override - public final void run() { - try { - server.stop(); - - System.err.println("Server is down."); - } catch (final Exception e) { - throw new RuntimeException(e); - } - } - }); - - new Thread() { - @Override - public final void run() { - try { - AbstractEmbeddedServer.waitUrlAvailable("http://localhost:8080/plaintext"); - AbstractEmbeddedServer.waitUrlAvailable("http://localhost:8080/json"); - - System.err.println("Server test cases are instrumented and bootstrapped."); - } catch (final InterruptedException | IOException e) { - throw new RuntimeException(e); - } - } - }.start(); - } -} diff --git a/frameworks/Java/comsat/src/main/java/hello/webactors/NettyServer.java b/frameworks/Java/comsat/src/main/java/hello/webactors/NettyServer.java deleted file mode 100644 index 46ceca57efd..00000000000 --- a/frameworks/Java/comsat/src/main/java/hello/webactors/NettyServer.java +++ /dev/null @@ -1,68 +0,0 @@ -package hello.webactors; - -import co.paralleluniverse.comsat.webactors.netty.AutoWebActorHandler; -import co.paralleluniverse.embedded.containers.AbstractEmbeddedServer; -import hello.Server; -import io.netty.bootstrap.ServerBootstrap; -import io.netty.buffer.PooledByteBufAllocator; -import io.netty.channel.*; -import io.netty.channel.nio.NioEventLoopGroup; -import io.netty.channel.socket.SocketChannel; -import io.netty.channel.socket.nio.NioServerSocketChannel; -import io.netty.handler.codec.http.HttpObjectAggregator; -import io.netty.handler.codec.http.HttpRequestDecoder; -import io.netty.handler.codec.http.HttpResponseEncoder; - -import java.util.Map; -import java.util.concurrent.Callable; - -public final class NettyServer implements Server { - @Override - public final void run() throws Exception { - WebActor.SERVER = "comsat-webactors-netty"; - final ServerBootstrap b = new ServerBootstrap(); - - b.option(ChannelOption.SO_BACKLOG, 100000); - b.childOption(ChannelOption.CONNECT_TIMEOUT_MILLIS, 0); - b.childOption(ChannelOption.TCP_NODELAY, true); - b.childOption(ChannelOption.SO_REUSEADDR, true); - b.childOption(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT); - - final ChannelInitializer childHandler = new SocketChannelChannelInitializer(() -> new AutoWebActorHandler() { - @Override - protected AutoContextProvider newContextProvider(ClassLoader userClassLoader, Map, Object[]> actorParams) { - return new AutoContextProvider(userClassLoader, actorParams, 1_000_000L /* ms */); - } - }); - final NioEventLoopGroup group = new NioEventLoopGroup(200); - b.group(group) - .channel(NioServerSocketChannel.class) - .childHandler(childHandler); - - final ChannelFuture cf = b.bind(8080); - cf.sync(); - - System.err.println("Server is up."); - - AbstractEmbeddedServer.waitUrlAvailable("http://localhost:8080/plaintext"); - AbstractEmbeddedServer.waitUrlAvailable("http://localhost:8080/json"); - System.err.println("Server test cases are instrumented and bootstrapped."); - } - - private static final class SocketChannelChannelInitializer extends ChannelInitializer { - private final Callable> handlerProvider; - - public SocketChannelChannelInitializer(Callable> handlerProvider) { - this.handlerProvider = handlerProvider; - } - - @Override - public final void initChannel(SocketChannel ch) throws Exception { - final ChannelPipeline pipeline = ch.pipeline(); - pipeline.addLast(new HttpRequestDecoder()); - pipeline.addLast(new HttpResponseEncoder()); - pipeline.addLast(new HttpObjectAggregator(65536)); - pipeline.addLast(handlerProvider.call()); - } - } -} diff --git a/frameworks/Java/comsat/src/main/java/hello/webactors/UndertowServer.java b/frameworks/Java/comsat/src/main/java/hello/webactors/UndertowServer.java deleted file mode 100644 index cb86911ebd3..00000000000 --- a/frameworks/Java/comsat/src/main/java/hello/webactors/UndertowServer.java +++ /dev/null @@ -1,57 +0,0 @@ -package hello.webactors; - -import co.paralleluniverse.comsat.webactors.undertow.AutoWebActorHandler; -import co.paralleluniverse.embedded.containers.AbstractEmbeddedServer; -import hello.Server; -import io.undertow.Undertow; -import io.undertow.UndertowOptions; - -import org.xnio.Options; - -public final class UndertowServer implements Server { - @Override - public final void run() throws Exception { - WebActor.SERVER = "comsat-webactors-undertow"; - //noinspection deprecation - final Undertow u = io.undertow.Undertow.builder() - .setHandler(new AutoWebActorHandler()) - - .setIoThreads(100) - .setWorkerThreads(100) - .setServerOption(Options.CONNECTION_HIGH_WATER, 100_000) - .setServerOption(Options.CONNECTION_LOW_WATER, 100_000) - - .setDirectBuffers(true) - .setBufferSize(1024) - .setBuffersPerRegion(100) - - // .setSocketOption(Options.ALLOW_BLOCKING, true) - .setSocketOption(Options.REUSE_ADDRESSES, true) - // .setSocketOption(Options.CORK, true) - // .setSocketOption(Options.USE_DIRECT_BUFFERS, true) - .setSocketOption(Options.BACKLOG, 100000) - .setSocketOption(Options.TCP_NODELAY, true) - // .setSocketOption(Options.RECEIVE_BUFFER, 2048) - // .setSocketOption(Options.SEND_BUFFER, 2048) - // .setSocketOption(Options.CONNECTION_HIGH_WATER, Integer.MAX_VALUE) - // .setSocketOption(Options.CONNECTION_LOW_WATER, Integer.MAX_VALUE) - // .setSocketOption(Options.READ_TIMEOUT, Integer.MAX_VALUE) - // .setSocketOption(Options.WRITE_TIMEOUT, Integer.MAX_VALUE) - // .setServerOption(UndertowOptions.ALWAYS_SET_KEEP_ALIVE, false) //don't send a keep-alive header for HTTP/1.1 requests, as it is not required - - // .setServerOption(UndertowOptions.ALWAYS_SET_DATE, true) - .setServerOption(UndertowOptions.ENABLE_CONNECTOR_STATISTICS, false) - .setServerOption(UndertowOptions.RECORD_REQUEST_START_TIME, false) - - .addHttpListener(8080, "0.0.0.0") - .build(); - - new Thread(u::start).start(); - - System.err.println("Server is up."); - - AbstractEmbeddedServer.waitUrlAvailable("http://localhost:8080/plaintext"); - AbstractEmbeddedServer.waitUrlAvailable("http://localhost:8080/json"); - System.err.println("Server test cases are instrumented and bootstrapped."); - } -} diff --git a/frameworks/Java/comsat/src/main/java/hello/webactors/WebActor.java b/frameworks/Java/comsat/src/main/java/hello/webactors/WebActor.java deleted file mode 100644 index 8fb559ff3a6..00000000000 --- a/frameworks/Java/comsat/src/main/java/hello/webactors/WebActor.java +++ /dev/null @@ -1,57 +0,0 @@ -package hello.webactors; - -import co.paralleluniverse.actors.BasicActor; -import co.paralleluniverse.comsat.webactors.HttpRequest; -import co.paralleluniverse.comsat.webactors.HttpResponse; - -import co.paralleluniverse.fibers.SuspendExecution; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; - -import java.nio.ByteBuffer; - -import static co.paralleluniverse.comsat.webactors.HttpResponse.error; -import static co.paralleluniverse.comsat.webactors.HttpResponse.ok; - -@co.paralleluniverse.comsat.webactors.WebActor(httpUrlPatterns = {"/*"}) -public final class WebActor extends BasicActor { - static String SERVER = "comsat-webactors"; - - private static final String HELLO_WORLD = "Hello, World!"; - private static final byte[] HELLO_WORLD_A = HELLO_WORLD.getBytes(); - - private static final class HelloWorldData { - @SuppressWarnings("unused") - public final String message = HELLO_WORLD; - } - - private static final ObjectMapper mapper = new ObjectMapper(); - - @Override - protected final Void doRun() throws InterruptedException, SuspendExecution { - final Object message = receive(); - if (message instanceof HttpRequest) { - final HttpRequest req = (HttpRequest) message; - HttpResponse.Builder res; - final String s = req.getRequestURI(); - if ("/plaintext".equals(s)) { - final ByteBuffer b = ByteBuffer.wrap(HELLO_WORLD_A); - res = ok(self(), req, b).setContentType("text/plain"); - } else if ("/json".equals(s)) { - try { - res = ok(self(), req, mapper.writeValueAsString(new HelloWorldData())).setContentType("application/json"); - } catch (final JsonProcessingException e) { - throw new RuntimeException(e); - } - } else { - res = error(self(), req, 404, "Not found"); - } - req.getFrom().send ( - res - .addHeader("Server", SERVER) - .build() - ); - } - return null; - } -} From da0744cb2554713b54eeff2d6d9db19c1c86f9dc Mon Sep 17 00:00:00 2001 From: Petrik de Heus Date: Tue, 11 Jun 2024 22:15:48 +0200 Subject: [PATCH 33/45] Remove old Weppy framework (#9104) Weppy was renamed to Emmett which already is tested. See: - https://github.com/emmett-framework/emmett/commit/11fe3cac4838c6f1b79339b50a0bcf3557a17069 - https://github.com/gi0baro/weppy (weppy redirects to emmett) --- frameworks/Python/weppy/README.md | 33 ----- frameworks/Python/weppy/app.py | 128 ------------------ frameworks/Python/weppy/benchmark_config.json | 97 ------------- frameworks/Python/weppy/config.toml | 70 ---------- frameworks/Python/weppy/gunicorn_conf.py | 26 ---- frameworks/Python/weppy/nginx.conf | 48 ------- frameworks/Python/weppy/requirements-pypy.txt | 4 - frameworks/Python/weppy/requirements.txt | 6 - .../Python/weppy/templates/fortunes.html | 20 --- frameworks/Python/weppy/uwsgi.ini | 19 --- .../Python/weppy/weppy-nginx-uwsgi.dockerfile | 19 --- frameworks/Python/weppy/weppy-py3.dockerfile | 11 -- .../Python/weppy/weppy-pypy2.dockerfile | 11 -- frameworks/Python/weppy/weppy.dockerfile | 11 -- 14 files changed, 503 deletions(-) delete mode 100644 frameworks/Python/weppy/README.md delete mode 100644 frameworks/Python/weppy/app.py delete mode 100644 frameworks/Python/weppy/benchmark_config.json delete mode 100644 frameworks/Python/weppy/config.toml delete mode 100644 frameworks/Python/weppy/gunicorn_conf.py delete mode 100644 frameworks/Python/weppy/nginx.conf delete mode 100644 frameworks/Python/weppy/requirements-pypy.txt delete mode 100644 frameworks/Python/weppy/requirements.txt delete mode 100644 frameworks/Python/weppy/templates/fortunes.html delete mode 100644 frameworks/Python/weppy/uwsgi.ini delete mode 100644 frameworks/Python/weppy/weppy-nginx-uwsgi.dockerfile delete mode 100644 frameworks/Python/weppy/weppy-py3.dockerfile delete mode 100644 frameworks/Python/weppy/weppy-pypy2.dockerfile delete mode 100644 frameworks/Python/weppy/weppy.dockerfile diff --git a/frameworks/Python/weppy/README.md b/frameworks/Python/weppy/README.md deleted file mode 100644 index 9292402d79f..00000000000 --- a/frameworks/Python/weppy/README.md +++ /dev/null @@ -1,33 +0,0 @@ -# weppy Benchmark Test (ported from Flask example) - -This is the weppy portion of a [benchmarking tests suite](../../) -comparing a variety of web development platforms. - -The information below is specific to weppy. For further guidance, -review the [documentation](https://github.com/TechEmpower/FrameworkBenchmarks/wiki). -Also note that there is additional information provided in -the [Python README](../). - -[weppy](http://weppy.org/) is a fullstack Python 2/3 web framework. -This test uses the included ORM and templating system, and gunicorn+meinheld for the application server on CPtyhon and Tornado on pypy. - -## Test Paths & Source - -* [JSON Serialization](app.py): "/json" -* [Single Database Query](app.py): "/db" -* [Multiple Database Queries](app.py): "queries?queries=#" -* [Fortunes](app.py): "/fortunes" -* [Database Updates](app.py): "updates?queries=#" -* [Plaintext](app.py): "/plaintext" - -*Replace # with an actual number. - -### Resources - -* [weppy Source Code](https://github.com/gi0baro/weppy) -* [weppy Documentation](http://weppy.org/docs) - -### Community - -* [weppy (weppy-talk) Google Group](https://groups.google.com/forum/#!forum/weppy-talk) - diff --git a/frameworks/Python/weppy/app.py b/frameworks/Python/weppy/app.py deleted file mode 100644 index 23a461d8340..00000000000 --- a/frameworks/Python/weppy/app.py +++ /dev/null @@ -1,128 +0,0 @@ -import sys -from functools import partial -from random import randint -from weppy import App, Pipe, request, response -from weppy.orm import Database, Model, Field, rowmethod -from weppy.tools import service -from email.utils import formatdate - -_is_pypy = hasattr(sys, 'pypy_version_info') -if sys.version_info[0] == 3: - xrange = range - -DBHOSTNAME = 'tfb-database' - -app = App(__name__) - - -class World(Model): - tablename = "world" - randomnumber = Field.int() - - @rowmethod('serialize') - def _serialize(self, row): - return {'id': row.id, 'randomNumber': row.randomnumber} - - -class Fortune(Model): - tablename = "fortune" - message = Field.string() - - @rowmethod('serialize') - def _serialize(self, row): - return {'id': row.id, 'message': row.message} - - -class DateHeaderPipe(Pipe): - def open(self): - response.headers["Date"] = formatdate(timeval=None, localtime=False, usegmt=True) - - -app.config.handle_static = False -app.config.db.adapter = 'postgres:psycopg2' \ - if not _is_pypy else 'postgres:pg8000' -app.config.db.host = DBHOSTNAME -app.config.db.user = 'benchmarkdbuser' -app.config.db.password = 'benchmarkdbpass' -app.config.db.database = 'hello_world' -app.config.db.pool_size = 100 - -app.pipeline = [DateHeaderPipe()] - -db = Database(app, auto_migrate=False) -db.define_models(World, Fortune) - - -@app.route() -@service.json -def json(): - return {'message': 'Hello, World!'} - - -@app.route("/db", pipeline=[db.pipe]) -@service.json -def get_random_world(): - return World.get(randint(1, 10000)).serialize() - - -def get_qparam(): - try: - rv = int(request.query_params.queries) - if rv < 1: - rv = 1 - if rv > 500: - rv = 500 - except: - rv = 1 - return rv - - -@app.route("/queries", pipeline=[db.pipe]) -@service.json -def get_random_worlds(): - num_queries = get_qparam() - worlds = [ - World.get(randint(1, 10000)).serialize() for _ in xrange(num_queries)] - return worlds - - -@app.route(pipeline=[db.pipe]) -def fortunes(): - fortunes = Fortune.all().select() - fortunes.append( - Fortune.new(id=0, message="Additional fortune added at request time.")) - fortunes.sort(lambda m: m.message) - return {'fortunes': fortunes} - - -@app.route(pipeline=[db.pipe]) -@service.json -def updates(): - num_queries = get_qparam() - worlds = [] - rp = partial(randint, 1, 10000) - ids = [rp() for _ in xrange(num_queries)] - ids.sort() # To avoid deadlock - for id in ids: - world = World.get(id) - world.update_record(randomnumber=rp()) - worlds.append(world.serialize()) - return worlds - - -@app.route() -def plaintext(): - response.headers["Content-Type"] = "text/plain" - return 'Hello, World!' - - -try: - import meinheld - meinheld.server.set_access_logger(None) - meinheld.set_keepalive(120) -except ImportError: - pass - -# entry point for debugging -if __name__ == "__main__": - app.run(debug=True) diff --git a/frameworks/Python/weppy/benchmark_config.json b/frameworks/Python/weppy/benchmark_config.json deleted file mode 100644 index 3b989c719dc..00000000000 --- a/frameworks/Python/weppy/benchmark_config.json +++ /dev/null @@ -1,97 +0,0 @@ -{ - "framework": "weppy", - "tests": [{ - "default": { - "json_url": "/json", - "db_url": "/db", - "query_url": "/queries?queries=", - "fortune_url": "/fortunes", - "update_url": "/updates?queries=", - "plaintext_url": "/plaintext", - "port": 8080, - "approach": "Realistic", - "classification": "Fullstack", - "database": "Postgres", - "framework": "weppy", - "language": "Python", - "orm": "Full", - "platform": "Meinheld", - "webserver": "None", - "os": "Linux", - "database_os": "Linux", - "display_name": "weppy-Py2", - "notes": "CPython 2.7", - "versus": "wsgi", - "tags": ["broken"] - }, - "py3": { - "json_url": "/json", - "db_url": "/db", - "query_url": "/queries?queries=", - "fortune_url": "/fortunes", - "update_url": "/updates?queries=", - "plaintext_url": "/plaintext", - "port": 8080, - "approach": "Realistic", - "classification": "Fullstack", - "database": "Postgres", - "framework": "weppy", - "language": "Python", - "orm": "Full", - "platform": "Meinheld", - "webserver": "None", - "os": "Linux", - "database_os": "Linux", - "display_name": "weppy-Py3", - "notes": "CPython 3.6", - "versus": "wsgi" - }, - "pypy2": { - "json_url": "/json", - "db_url": "/db", - "query_url": "/queries?queries=", - "fortune_url": "/fortunes", - "update_url": "/updates?queries=", - "plaintext_url": "/plaintext", - "port": 8080, - "approach": "Realistic", - "classification": "Fullstack", - "database": "Postgres", - "framework": "weppy", - "language": "Python", - "flavor": "PyPy2", - "orm": "Full", - "platform": "Tornado", - "webserver": "None", - "os": "Linux", - "database_os": "Linux", - "display_name": "weppy-PyPy2", - "notes": "PyPy2", - "versus": "wsgi", - "tags": ["broken"] - }, - "nginx-uwsgi": { - "json_url": "/json", - "db_url": "/db", - "query_url": "/queries?queries=", - "fortune_url": "/fortunes", - "update_url": "/updates?queries=", - "plaintext_url": "/plaintext", - "port": 8080, - "approach": "Realistic", - "classification": "Fullstack", - "database": "Postgres", - "framework": "weppy", - "language": "Python", - "orm": "Full", - "platform": "uWSGI", - "webserver": "nginx", - "os": "Linux", - "database_os": "Linux", - "display_name": "weppy-nginx-uWSGI", - "notes": "CPython 3.6", - "versus": "wsgi", - "tags": ["broken"] - } - }] -} diff --git a/frameworks/Python/weppy/config.toml b/frameworks/Python/weppy/config.toml deleted file mode 100644 index baceb6e8747..00000000000 --- a/frameworks/Python/weppy/config.toml +++ /dev/null @@ -1,70 +0,0 @@ -[framework] -name = "weppy" - -[main] -urls.plaintext = "/plaintext" -urls.json = "/json" -urls.db = "/db" -urls.query = "/queries?queries=" -urls.update = "/updates?queries=" -urls.fortune = "/fortunes" -approach = "Realistic" -classification = "Fullstack" -database = "Postgres" -database_os = "Linux" -os = "Linux" -orm = "Full" -platform = "Meinheld" -webserver = "None" -versus = "wsgi" - -[py3] -urls.plaintext = "/plaintext" -urls.json = "/json" -urls.db = "/db" -urls.query = "/queries?queries=" -urls.update = "/updates?queries=" -urls.fortune = "/fortunes" -approach = "Realistic" -classification = "Fullstack" -database = "Postgres" -database_os = "Linux" -os = "Linux" -orm = "Full" -platform = "Meinheld" -webserver = "None" -versus = "wsgi" - -[nginx-uwsgi] -urls.plaintext = "/plaintext" -urls.json = "/json" -urls.db = "/db" -urls.query = "/queries?queries=" -urls.update = "/updates?queries=" -urls.fortune = "/fortunes" -approach = "Realistic" -classification = "Fullstack" -database = "Postgres" -database_os = "Linux" -os = "Linux" -orm = "Full" -platform = "uWSGI" -webserver = "nginx" -versus = "wsgi" - -[pypy2] -urls.plaintext = "/plaintext" -urls.json = "/json" -urls.db = "/db" -urls.query = "/queries?queries=" -urls.update = "/updates?queries=" -urls.fortune = "/fortunes" -approach = "Realistic" -classification = "Fullstack" -database = "Postgres" -database_os = "Linux" -os = "Linux" -orm = "Full" -platform = "Tornado" -webserver = "None" -versus = "wsgi" diff --git a/frameworks/Python/weppy/gunicorn_conf.py b/frameworks/Python/weppy/gunicorn_conf.py deleted file mode 100644 index 817008b6d65..00000000000 --- a/frameworks/Python/weppy/gunicorn_conf.py +++ /dev/null @@ -1,26 +0,0 @@ -import multiprocessing -import os -import sys - -_is_pypy = hasattr(sys, 'pypy_version_info') -_is_travis = os.environ.get('TRAVIS') == 'true' - -workers = multiprocessing.cpu_count() * 3 -if _is_travis: - workers = 2 - -bind = "0.0.0.0:8080" -keepalive = 120 -errorlog = '-' -pidfile = 'gunicorn.pid' - -if _is_pypy: - worker_class = "tornado" -else: - worker_class = "meinheld.gmeinheld.MeinheldWorker" - - def post_fork(server, worker): - # Disable access log. - # (Until https://github.com/mopemope/meinheld/pull/42 is released) - import meinheld.server - meinheld.server.set_access_logger(None) diff --git a/frameworks/Python/weppy/nginx.conf b/frameworks/Python/weppy/nginx.conf deleted file mode 100644 index 38c0c61341c..00000000000 --- a/frameworks/Python/weppy/nginx.conf +++ /dev/null @@ -1,48 +0,0 @@ -# This file is based on /usr/local/nginx/conf/nginx.conf.default. - -# One worker process per core -error_log stderr error; - -events { - # This needed to be increased because the nginx error log said so. - # http://nginx.org/en/docs/ngx_core_module.html#worker_connections - worker_connections 65535; - multi_accept on; -} - -http { - default_type application/octet-stream; - client_body_temp_path /tmp; - - # turn off request logging for performance - access_log off; - - # I think these only options affect static file serving - sendfile on; - tcp_nopush on; - - # Allow many HTTP Keep-Alive requests in a single TCP connection before - # closing it (the default is 100). This will minimize the total number - # of TCP connections opened/closed. The problem is that this may cause - # some worker processes to be handling too connections relative to the - # other workers based on an initial imbalance, so this is disabled for - # now. -# keepalive_requests 1000; - - #keepalive_timeout 0; - keepalive_timeout 65; - - server { - # For information on deferred, see: - # http://nginx.org/en/docs/http/ngx_http_core_module.html#listen - # http://www.techrepublic.com/article/take-advantage-of-tcp-ip-options-to-optimize-data-transmission/ - # The backlog argument to listen() is set to match net.ipv4.tcp_max_syn_backlog and net.core.somaxconn - listen 8080 default_server deferred reuseport backlog=65535; - server_name localhost; - - location / { - uwsgi_pass unix:/var/tmp/uwsgi.sock; - include /usr/local/nginx/conf/uwsgi_params; - } - } -} diff --git a/frameworks/Python/weppy/requirements-pypy.txt b/frameworks/Python/weppy/requirements-pypy.txt deleted file mode 100644 index e56b1b00d5f..00000000000 --- a/frameworks/Python/weppy/requirements-pypy.txt +++ /dev/null @@ -1,4 +0,0 @@ -pg8000==1.10.6 -weppy==1.3 -gunicorn==19.9.0 -tornado==6.3.3 diff --git a/frameworks/Python/weppy/requirements.txt b/frameworks/Python/weppy/requirements.txt deleted file mode 100644 index 078948040eb..00000000000 --- a/frameworks/Python/weppy/requirements.txt +++ /dev/null @@ -1,6 +0,0 @@ -psycopg2==2.7.5 -weppy==1.3 -gunicorn==19.9.0 -meinheld==1.0.2 -uwsgi==2.0.22 -greenlet==0.4.14 diff --git a/frameworks/Python/weppy/templates/fortunes.html b/frameworks/Python/weppy/templates/fortunes.html deleted file mode 100644 index 07d84854bcc..00000000000 --- a/frameworks/Python/weppy/templates/fortunes.html +++ /dev/null @@ -1,20 +0,0 @@ - - - - Fortunes - - - - - - - - {{for fortune in fortunes:}} - - - - - {{pass}} -
idmessage
{{=fortune.id}}{{=fortune.message}}
- - diff --git a/frameworks/Python/weppy/uwsgi.ini b/frameworks/Python/weppy/uwsgi.ini deleted file mode 100644 index 5c9f5b80227..00000000000 --- a/frameworks/Python/weppy/uwsgi.ini +++ /dev/null @@ -1,19 +0,0 @@ -[uwsgi] -master -; Increase listen queue used for nginx connecting to uWSGI. This matches -; net.ipv4.tcp_max_syn_backlog and net.core.somaxconn. -listen = 16384 -; for performance -disable-logging -; use UNIX sockets instead of TCP loopback for performance -socket = /var/tmp/uwsgi.sock -; allow nginx to access the UNIX socket -chmod-socket = 666 -; Avoid thundering herd problem http://uwsgi-docs.readthedocs.org/en/latest/articles/SerializingAccept.html . -; This is currently disabled because when I tried it with flask, it caused a -; 20% performance hit. The CPU cores could not be saturated with thunder-lock. -; I'm not yet sure the full story, so this is presently disabled. Also, -; disabling this caused bottle to get ~13% faster. -;thunder-lock -; used by uwsgi_stop.ini -pidfile = /var/tmp/uwsgi.pid diff --git a/frameworks/Python/weppy/weppy-nginx-uwsgi.dockerfile b/frameworks/Python/weppy/weppy-nginx-uwsgi.dockerfile deleted file mode 100644 index e29f5447c0d..00000000000 --- a/frameworks/Python/weppy/weppy-nginx-uwsgi.dockerfile +++ /dev/null @@ -1,19 +0,0 @@ -FROM python:3.6.6-stretch - -RUN curl -s http://nginx.org/keys/nginx_signing.key | apt-key add - -RUN echo "deb http://nginx.org/packages/debian/ stretch nginx" >> /etc/apt/sources.list -RUN echo "deb-src http://nginx.org/packages/debian/ stretch nginx" >> /etc/apt/sources.list - -RUN apt-get update -yqq && apt-get install -yqq nginx - -ADD ./ /weppy - -WORKDIR /weppy - -RUN pip install -r /weppy/requirements.txt - -RUN sed -i 's|include .*/conf/uwsgi_params;|include /etc/nginx/uwsgi_params;|g' /weppy/nginx.conf - -EXPOSE 8080 - -CMD nginx -c /weppy/nginx.conf && uwsgi --ini /weppy/uwsgi.ini --processes $(nproc) --wsgi app:app diff --git a/frameworks/Python/weppy/weppy-py3.dockerfile b/frameworks/Python/weppy/weppy-py3.dockerfile deleted file mode 100644 index 4591004350d..00000000000 --- a/frameworks/Python/weppy/weppy-py3.dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -FROM python:3.6.6-stretch - -ADD ./ /weppy - -WORKDIR /weppy - -RUN pip3 install -r /weppy/requirements.txt - -EXPOSE 8080 - -CMD gunicorn app:app -c gunicorn_conf.py diff --git a/frameworks/Python/weppy/weppy-pypy2.dockerfile b/frameworks/Python/weppy/weppy-pypy2.dockerfile deleted file mode 100644 index 7c5a6a14abf..00000000000 --- a/frameworks/Python/weppy/weppy-pypy2.dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -FROM pypy:2-5.10 - -ADD ./ /weppy - -WORKDIR /weppy - -RUN pip install -r /weppy/requirements-pypy.txt - -EXPOSE 8080 - -CMD gunicorn app:app -c gunicorn_conf.py diff --git a/frameworks/Python/weppy/weppy.dockerfile b/frameworks/Python/weppy/weppy.dockerfile deleted file mode 100644 index 5f840729f96..00000000000 --- a/frameworks/Python/weppy/weppy.dockerfile +++ /dev/null @@ -1,11 +0,0 @@ -FROM python:2.7.15-stretch - -ADD ./ /weppy - -WORKDIR /weppy - -RUN pip install -r /weppy/requirements.txt - -EXPOSE 8080 - -CMD gunicorn app:app -c gunicorn_conf.py From 565ab137763380757035658e6da600b08d1f8dbb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 11 Jun 2024 13:18:18 -0700 Subject: [PATCH 34/45] Bump actiontext from 7.1.3.3 to 7.1.3.4 in /frameworks/Ruby/rails (#9091) Bumps [actiontext](https://github.com/rails/rails) from 7.1.3.3 to 7.1.3.4. - [Release notes](https://github.com/rails/rails/releases) - [Changelog](https://github.com/rails/rails/blob/v7.1.3.4/actiontext/CHANGELOG.md) - [Commits](https://github.com/rails/rails/compare/v7.1.3.3...v7.1.3.4) --- updated-dependencies: - dependency-name: actiontext dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- frameworks/Ruby/rails/Gemfile.lock | 110 ++++++++++++++--------------- 1 file changed, 55 insertions(+), 55 deletions(-) diff --git a/frameworks/Ruby/rails/Gemfile.lock b/frameworks/Ruby/rails/Gemfile.lock index 9d15aecbab6..5c25771e659 100644 --- a/frameworks/Ruby/rails/Gemfile.lock +++ b/frameworks/Ruby/rails/Gemfile.lock @@ -1,35 +1,35 @@ GEM remote: https://rubygems.org/ specs: - actioncable (7.1.3.3) - actionpack (= 7.1.3.3) - activesupport (= 7.1.3.3) + actioncable (7.1.3.4) + actionpack (= 7.1.3.4) + activesupport (= 7.1.3.4) nio4r (~> 2.0) websocket-driver (>= 0.6.1) zeitwerk (~> 2.6) - actionmailbox (7.1.3.3) - actionpack (= 7.1.3.3) - activejob (= 7.1.3.3) - activerecord (= 7.1.3.3) - activestorage (= 7.1.3.3) - activesupport (= 7.1.3.3) + actionmailbox (7.1.3.4) + actionpack (= 7.1.3.4) + activejob (= 7.1.3.4) + activerecord (= 7.1.3.4) + activestorage (= 7.1.3.4) + activesupport (= 7.1.3.4) mail (>= 2.7.1) net-imap net-pop net-smtp - actionmailer (7.1.3.3) - actionpack (= 7.1.3.3) - actionview (= 7.1.3.3) - activejob (= 7.1.3.3) - activesupport (= 7.1.3.3) + actionmailer (7.1.3.4) + actionpack (= 7.1.3.4) + actionview (= 7.1.3.4) + activejob (= 7.1.3.4) + activesupport (= 7.1.3.4) mail (~> 2.5, >= 2.5.4) net-imap net-pop net-smtp rails-dom-testing (~> 2.2) - actionpack (7.1.3.3) - actionview (= 7.1.3.3) - activesupport (= 7.1.3.3) + actionpack (7.1.3.4) + actionview (= 7.1.3.4) + activesupport (= 7.1.3.4) nokogiri (>= 1.8.5) racc rack (>= 2.2.4) @@ -37,35 +37,35 @@ GEM rack-test (>= 0.6.3) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - actiontext (7.1.3.3) - actionpack (= 7.1.3.3) - activerecord (= 7.1.3.3) - activestorage (= 7.1.3.3) - activesupport (= 7.1.3.3) + actiontext (7.1.3.4) + actionpack (= 7.1.3.4) + activerecord (= 7.1.3.4) + activestorage (= 7.1.3.4) + activesupport (= 7.1.3.4) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.1.3.3) - activesupport (= 7.1.3.3) + actionview (7.1.3.4) + activesupport (= 7.1.3.4) builder (~> 3.1) erubi (~> 1.11) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - activejob (7.1.3.3) - activesupport (= 7.1.3.3) + activejob (7.1.3.4) + activesupport (= 7.1.3.4) globalid (>= 0.3.6) - activemodel (7.1.3.3) - activesupport (= 7.1.3.3) - activerecord (7.1.3.3) - activemodel (= 7.1.3.3) - activesupport (= 7.1.3.3) + activemodel (7.1.3.4) + activesupport (= 7.1.3.4) + activerecord (7.1.3.4) + activemodel (= 7.1.3.4) + activesupport (= 7.1.3.4) timeout (>= 0.4.0) - activestorage (7.1.3.3) - actionpack (= 7.1.3.3) - activejob (= 7.1.3.3) - activerecord (= 7.1.3.3) - activesupport (= 7.1.3.3) + activestorage (7.1.3.4) + actionpack (= 7.1.3.4) + activejob (= 7.1.3.4) + activerecord (= 7.1.3.4) + activesupport (= 7.1.3.4) marcel (~> 1.0) - activesupport (7.1.3.3) + activesupport (7.1.3.4) base64 bigdecimal concurrent-ruby (~> 1.0, >= 1.0.2) @@ -78,7 +78,7 @@ GEM base64 (0.2.0) bigdecimal (3.1.8) builder (3.2.4) - concurrent-ruby (1.2.3) + concurrent-ruby (1.3.1) connection_pool (2.4.1) crass (1.0.6) date (3.3.4) @@ -102,7 +102,7 @@ GEM net-smtp marcel (1.0.4) mini_mime (1.1.5) - mini_portile2 (2.8.6) + mini_portile2 (2.8.7) minitest (5.23.1) mutex_m (0.2.0) net-imap (0.4.11) @@ -138,20 +138,20 @@ GEM rackup (2.1.0) rack (>= 3) webrick (~> 1.8) - rails (7.1.3.3) - actioncable (= 7.1.3.3) - actionmailbox (= 7.1.3.3) - actionmailer (= 7.1.3.3) - actionpack (= 7.1.3.3) - actiontext (= 7.1.3.3) - actionview (= 7.1.3.3) - activejob (= 7.1.3.3) - activemodel (= 7.1.3.3) - activerecord (= 7.1.3.3) - activestorage (= 7.1.3.3) - activesupport (= 7.1.3.3) + rails (7.1.3.4) + actioncable (= 7.1.3.4) + actionmailbox (= 7.1.3.4) + actionmailer (= 7.1.3.4) + actionpack (= 7.1.3.4) + actiontext (= 7.1.3.4) + actionview (= 7.1.3.4) + activejob (= 7.1.3.4) + activemodel (= 7.1.3.4) + activerecord (= 7.1.3.4) + activestorage (= 7.1.3.4) + activesupport (= 7.1.3.4) bundler (>= 1.15.0) - railties (= 7.1.3.3) + railties (= 7.1.3.4) rails-dom-testing (2.2.0) activesupport (>= 5.0.0) minitest @@ -159,9 +159,9 @@ GEM rails-html-sanitizer (1.6.0) loofah (~> 2.21) nokogiri (~> 1.14) - railties (7.1.3.3) - actionpack (= 7.1.3.3) - activesupport (= 7.1.3.3) + railties (7.1.3.4) + actionpack (= 7.1.3.4) + activesupport (= 7.1.3.4) irb rackup (>= 1.0.0) rake (>= 12.2) From 4a164f7c414a532c7e237448d32761add393de72 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 11 Jun 2024 13:18:38 -0700 Subject: [PATCH 35/45] Bump mysql2 from 3.9.7 to 3.9.8 in /frameworks/JavaScript/koa (#9089) Bumps [mysql2](https://github.com/sidorares/node-mysql2) from 3.9.7 to 3.9.8. - [Release notes](https://github.com/sidorares/node-mysql2/releases) - [Changelog](https://github.com/sidorares/node-mysql2/blob/master/Changelog.md) - [Commits](https://github.com/sidorares/node-mysql2/compare/v3.9.7...v3.9.8) --- updated-dependencies: - dependency-name: mysql2 dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- frameworks/JavaScript/koa/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frameworks/JavaScript/koa/package.json b/frameworks/JavaScript/koa/package.json index 2e0fb45a363..52cbf5ca886 100644 --- a/frameworks/JavaScript/koa/package.json +++ b/frameworks/JavaScript/koa/package.json @@ -12,7 +12,7 @@ "koa-hbs": "1.0.0", "koa-router": "7.4.0", "mongoose": "5.13.20", - "mysql2": "3.9.7", + "mysql2": "3.9.8", "pg": "8.5.1", "pg-hstore": "2.3.2", "sequelize": "6.29.0" From dcbfae85be12b83db587f2b7d021b3d16095a945 Mon Sep 17 00:00:00 2001 From: Petrik de Heus Date: Thu, 13 Jun 2024 17:50:02 +0200 Subject: [PATCH 36/45] [ruby/rack] Don't set redundant Content-Length header (#9015) This header already gets set by all servers except Unicorn. --- frameworks/Ruby/rack/hello_world.rb | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/frameworks/Ruby/rack/hello_world.rb b/frameworks/Ruby/rack/hello_world.rb index be1cfe31a3e..2fcacec605b 100644 --- a/frameworks/Ruby/rack/hello_world.rb +++ b/frameworks/Ruby/rack/hello_world.rb @@ -65,14 +65,15 @@ def initialize end def respond(content_type, body = '') + headers = { + CONTENT_TYPE => content_type, + DATE => Time.now.utc.httpdate, + SERVER => SERVER_STRING + } + headers[CONTENT_LENGTH] = body.bytesize.to_s if defined?(Unicorn) [ 200, - { - CONTENT_TYPE => content_type, - DATE => Time.now.utc.httpdate, - SERVER => SERVER_STRING, - CONTENT_LENGTH => body.bytesize.to_s - }, + headers, [body] ] end From 09f932a7bb0907ffadc03f9bc2569e04f0caa879 Mon Sep 17 00:00:00 2001 From: Sam Gammon Date: Thu, 13 Jun 2024 09:03:22 -0700 Subject: [PATCH 37/45] [Elide] add elide runtime (#9097) Adds Elide, a new polyglot runtime built on top of GraalVM. For now, JavaScript server benchmarking is added; Python and Ruby will follow later (Elide runs all three). Signed-off-by: Sam Gammon --- frameworks/JavaScript/elide/README.md | 49 +++++++++++++++++++ .../JavaScript/elide/benchmark_config.json | 20 ++++++++ frameworks/JavaScript/elide/config.toml | 15 ++++++ frameworks/JavaScript/elide/elide.dockerfile | 11 +++++ frameworks/JavaScript/elide/src/server.js | 26 ++++++++++ 5 files changed, 121 insertions(+) create mode 100644 frameworks/JavaScript/elide/README.md create mode 100644 frameworks/JavaScript/elide/benchmark_config.json create mode 100644 frameworks/JavaScript/elide/config.toml create mode 100644 frameworks/JavaScript/elide/elide.dockerfile create mode 100644 frameworks/JavaScript/elide/src/server.js diff --git a/frameworks/JavaScript/elide/README.md b/frameworks/JavaScript/elide/README.md new file mode 100644 index 00000000000..7efbabcb033 --- /dev/null +++ b/frameworks/JavaScript/elide/README.md @@ -0,0 +1,49 @@ +# [Elide](https://github.com/elide-dev/elide) - A fast polyglot runtime + +## Description + +Elide is a runtime which can execute **JavaScript**, **Ruby**, **Python**, and others, all in one package. + +Elide is powered by [GraalVM](https://graalvm.org), which enables polyglot software design. Code units can interoperate from any supported language. + +The test script embedded for this benchmark uses Elide's built-in HTTP intrinsic from JavaScript: + +```javascript +// access the built-in HTTP server engine +const app = Elide.http; + +// register basic handler +app.router.handle("GET", "/plaintext", (request, response) => { + // respond using the captured path variables + response.send(200, "Hello, world!"); +}); + +// register a route handler +app.router.handle("GET", "/json", (request, response, context) => { + // respond using the captured path variables + response.send(200, JSON.stringify({ message: "Hello, world!" })); +}); + +// configure the server binding options +app.config.port = 3000; + +// receive a callback when the server starts +app.config.onBind(() => { + console.log(`Server listening at "http://localhost:${app.config.port}"! 🚀`); +}); + +// start the server +app.start(); +``` + +- [Elide Docs](https://docs.elide.dev) + +## Test URLs + +### Test 1: JSON Encoding + + http://localhost:3000/json + +### Test 2: Plaintext + + http://localhost:3000/plaintext diff --git a/frameworks/JavaScript/elide/benchmark_config.json b/frameworks/JavaScript/elide/benchmark_config.json new file mode 100644 index 00000000000..32c9d7e82aa --- /dev/null +++ b/frameworks/JavaScript/elide/benchmark_config.json @@ -0,0 +1,20 @@ +{ + "framework": "elide", + "tests": [{ + "default": { + "json_url": "/json", + "plaintext_url": "/plaintext", + "port": 3000, + "approach": "Realistic", + "classification": "Platform", + "language": "JavaScript", + "flavor": "elide", + "platform": "elide", + "webserver": "None", + "os": "Linux", + "database_os": "Linux", + "display_name": "elide", + "versus": "nodejs" + } + }] +} diff --git a/frameworks/JavaScript/elide/config.toml b/frameworks/JavaScript/elide/config.toml new file mode 100644 index 00000000000..542f38180fd --- /dev/null +++ b/frameworks/JavaScript/elide/config.toml @@ -0,0 +1,15 @@ +[framework] +name = "elide" + +[main] +urls.plaintext = "/plaintext" +urls.json = "/json" +approach = "Realistic" +classification = "Platform" +database_os = "Linux" +database = "None" +os = "Linux" +orm = "Raw" +platform = "elide" +webserver = "None" +versus = "nodejs" diff --git a/frameworks/JavaScript/elide/elide.dockerfile b/frameworks/JavaScript/elide/elide.dockerfile new file mode 100644 index 00000000000..f780fec96eb --- /dev/null +++ b/frameworks/JavaScript/elide/elide.dockerfile @@ -0,0 +1,11 @@ +FROM --platform=linux/amd64 ghcr.io/elide-dev/bench:1.0-alpha10-bench1-compat@sha256:1e679d95e18f9826c24a74d1709856849f53d3ca20c9bb25b548a8ec62424ad9 AS runtime + +EXPOSE 3000 + +WORKDIR /app + +COPY ./src . + +ENV NODE_ENV=production + +CMD ["elide", "serve", "server.js"] diff --git a/frameworks/JavaScript/elide/src/server.js b/frameworks/JavaScript/elide/src/server.js new file mode 100644 index 00000000000..1d564fe50d7 --- /dev/null +++ b/frameworks/JavaScript/elide/src/server.js @@ -0,0 +1,26 @@ +// access the built-in HTTP server engine +const app = Elide.http; + +// register basic handler +app.router.handle("GET", "/plaintext", (request, response) => { + // respond using the captured path variables + response.send(200, "Hello, world!"); +}); + +// register a route handler +app.router.handle("GET", "/json", (request, response, context) => { + // respond using the captured path variables + response.header("Content-Type", "application/json"); + response.send(200, JSON.stringify({ message: "Hello, world!" })); +}); + +// configure the server binding options +app.config.port = 3000; + +// receive a callback when the server starts +app.config.onBind(() => { + console.log(`Server listening at "http://localhost:${app.config.port}"! 🚀`); +}); + +// start the server +app.start(); From 20381d43125bf13610f8b1a095b05cb2d5937fb0 Mon Sep 17 00:00:00 2001 From: Vitaliy Busko Date: Fri, 14 Jun 2024 03:36:30 +0700 Subject: [PATCH 38/45] docs (rust/actix): update links in readme.md (#9116) --- frameworks/Rust/actix/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frameworks/Rust/actix/README.md b/frameworks/Rust/actix/README.md index def975cde32..78e6fd0306b 100644 --- a/frameworks/Rust/actix/README.md +++ b/frameworks/Rust/actix/README.md @@ -4,7 +4,7 @@ Actix web is a small, fast, pragmatic, open source rust web framework. -* [User Guide](https://actix.rs/book/actix-web/) +* [User Guide](https://actix.rs/docs/getting-started) * [API Documentation](https://docs.rs/actix-web/) * [Chat on gitter](https://gitter.im/actix/actix) * Cargo package: [actix-web](https://crates.io/crates/actix-web) From 6837c8099720623044db1f5000bc9ac05638ebc7 Mon Sep 17 00:00:00 2001 From: Roman Samoilov <2270393+rsamoilov@users.noreply.github.com> Date: Thu, 13 Jun 2024 21:37:23 +0100 Subject: [PATCH 39/45] [Ruby] Add rage-rb (#8908) --- frameworks/Ruby/rage/Gemfile | 13 ++++ frameworks/Ruby/rage/README.md | 47 +++++++++++ frameworks/Ruby/rage/Rakefile | 1 + .../app/controllers/application_controller.rb | 2 + .../app/controllers/benchmarks_controller.rb | 77 +++++++++++++++++++ .../rage/app/models/application_record.rb | 3 + frameworks/Ruby/rage/app/models/fortune.rb | 7 ++ frameworks/Ruby/rage/app/models/world.rb | 9 +++ .../Ruby/rage/app/views/fortunes.html.erb | 12 +++ frameworks/Ruby/rage/benchmark_config.json | 30 ++++++++ frameworks/Ruby/rage/config.ru | 4 + frameworks/Ruby/rage/config/application.rb | 14 ++++ .../rage/config/environments/development.rb | 4 + .../rage/config/environments/production.rb | 3 + .../rage/config/initializers/activerecord.rb | 17 ++++ frameworks/Ruby/rage/config/routes.rb | 10 +++ frameworks/Ruby/rage/lib/.keep | 0 frameworks/Ruby/rage/rage.dockerfile | 14 ++++ 18 files changed, 267 insertions(+) create mode 100644 frameworks/Ruby/rage/Gemfile create mode 100755 frameworks/Ruby/rage/README.md create mode 100644 frameworks/Ruby/rage/Rakefile create mode 100644 frameworks/Ruby/rage/app/controllers/application_controller.rb create mode 100644 frameworks/Ruby/rage/app/controllers/benchmarks_controller.rb create mode 100644 frameworks/Ruby/rage/app/models/application_record.rb create mode 100644 frameworks/Ruby/rage/app/models/fortune.rb create mode 100644 frameworks/Ruby/rage/app/models/world.rb create mode 100644 frameworks/Ruby/rage/app/views/fortunes.html.erb create mode 100755 frameworks/Ruby/rage/benchmark_config.json create mode 100644 frameworks/Ruby/rage/config.ru create mode 100644 frameworks/Ruby/rage/config/application.rb create mode 100644 frameworks/Ruby/rage/config/environments/development.rb create mode 100644 frameworks/Ruby/rage/config/environments/production.rb create mode 100644 frameworks/Ruby/rage/config/initializers/activerecord.rb create mode 100644 frameworks/Ruby/rage/config/routes.rb create mode 100644 frameworks/Ruby/rage/lib/.keep create mode 100644 frameworks/Ruby/rage/rage.dockerfile diff --git a/frameworks/Ruby/rage/Gemfile b/frameworks/Ruby/rage/Gemfile new file mode 100644 index 00000000000..a7f090d01f9 --- /dev/null +++ b/frameworks/Ruby/rage/Gemfile @@ -0,0 +1,13 @@ +source "https://rubygems.org" + +gem "rage-rb", "~> 1.3" + +gem "pg", "~> 1.0" +gem "activerecord", "~> 7.0.0", require: "active_record" + +# Build JSON APIs with ease +# gem "alba" + +# Get 50% to 150% boost when parsing JSON. +# Rage will automatically use FastJsonparser if it is available. +# gem "fast_jsonparser" diff --git a/frameworks/Ruby/rage/README.md b/frameworks/Ruby/rage/README.md new file mode 100755 index 00000000000..05e005bd363 --- /dev/null +++ b/frameworks/Ruby/rage/README.md @@ -0,0 +1,47 @@ +# Rage Benchmarking Test + +Rage is a fast web framework compatible with Rails. It uses an event-driven architecture and implements a lightweight, cooperative concurrency model based on Ruby Fibers. + +https://github.com/rage-rb/rage + +### Test Type Implementation Source Code + +* [JSON](app/controllers/benchmarks_controller.rb) +* [PLAINTEXT](app/controllers/benchmarks_controller.rb) +* [DB](app/controllers/benchmarks_controller.rb) +* [QUERY](app/controllers/benchmarks_controller.rb) +* [UPDATE](app/controllers/benchmarks_controller.rb) +* [FORTUNES](app/controllers/benchmarks_controller.rb) + +## Important Libraries + +The tests were run with: + +* [ActiveRecord](https://rubygems.org/gems/activerecord) +* [PG](https://rubygems.org/gems/pg) + +## Test URLs + +### JSON + +http://localhost:8080/json + +### PLAINTEXT + +http://localhost:8080/plaintext + +### DB + +http://localhost:8080/db + +### QUERY + +http://localhost:8080/queries?queries= + +### UPDATE + +http://localhost:8080/updates?queries= + +### FORTUNES + +http://localhost:8080/fortunes diff --git a/frameworks/Ruby/rage/Rakefile b/frameworks/Ruby/rage/Rakefile new file mode 100644 index 00000000000..046f1fcbd8d --- /dev/null +++ b/frameworks/Ruby/rage/Rakefile @@ -0,0 +1 @@ +require_relative "config/application" diff --git a/frameworks/Ruby/rage/app/controllers/application_controller.rb b/frameworks/Ruby/rage/app/controllers/application_controller.rb new file mode 100644 index 00000000000..c3238c52392 --- /dev/null +++ b/frameworks/Ruby/rage/app/controllers/application_controller.rb @@ -0,0 +1,2 @@ +class ApplicationController < RageController::API +end diff --git a/frameworks/Ruby/rage/app/controllers/benchmarks_controller.rb b/frameworks/Ruby/rage/app/controllers/benchmarks_controller.rb new file mode 100644 index 00000000000..884356e58c1 --- /dev/null +++ b/frameworks/Ruby/rage/app/controllers/benchmarks_controller.rb @@ -0,0 +1,77 @@ +# frozen_string_literal: true + +class BenchmarksController < ApplicationController + ALL_DB_IDS = (1..10_000).to_a + FORTUNES_TEMPLATE = ERB.new(Rage.root.join("app/views/fortunes.html.erb").read) + + before_action do + headers["server"] = "rage" + end + + def json + render json: { message: "Hello, World!" } + end + + def plaintext + render plain: "Hello, World!" + end + + def db + render json: World.find(random_id) + end + + def queries + records = requested_ids.map do |id| + World.find(id) + end + + render json: records + end + + def fortunes + records = Fortune.pluck(:id, :message).map! { |id, message| { id:, message: } } + + records << Fortune.new(id: 0, message: "Additional fortune added at request time.") + records.sort_by! { |record| record[:message] } + + render plain: FORTUNES_TEMPLATE.result(binding) + headers["content-type"] = "text/html; charset=utf-8" + end + + def updates + records = requested_ids.map do |id| + World.find(id) + end + + updates = records.map do |record| + new_value = random_id + new_value = random_id until new_value != record.randomNumber + + record.randomNumber = new_value + + { id: record.id, randomnumber: new_value } + end + + World.upsert_all(updates.sort_by! { |u| u[:id] }) + + render json: records + end + + private + + def requested_ids + num = params[:queries].to_i + + if num > 500 + num = 500 + elsif num < 1 + num = 1 + end + + ALL_DB_IDS.sample(num) + end + + def random_id + Random.rand(9_999) + 1 + end +end diff --git a/frameworks/Ruby/rage/app/models/application_record.rb b/frameworks/Ruby/rage/app/models/application_record.rb new file mode 100644 index 00000000000..b63caeb8a5c --- /dev/null +++ b/frameworks/Ruby/rage/app/models/application_record.rb @@ -0,0 +1,3 @@ +class ApplicationRecord < ActiveRecord::Base + primary_abstract_class +end diff --git a/frameworks/Ruby/rage/app/models/fortune.rb b/frameworks/Ruby/rage/app/models/fortune.rb new file mode 100644 index 00000000000..6b7ad122f80 --- /dev/null +++ b/frameworks/Ruby/rage/app/models/fortune.rb @@ -0,0 +1,7 @@ +class Fortune < ApplicationRecord + self.table_name = "Fortune" + + def as_json(*) + attributes + end +end diff --git a/frameworks/Ruby/rage/app/models/world.rb b/frameworks/Ruby/rage/app/models/world.rb new file mode 100644 index 00000000000..951aab55b64 --- /dev/null +++ b/frameworks/Ruby/rage/app/models/world.rb @@ -0,0 +1,9 @@ +class World < ApplicationRecord + self.table_name = "World" + + def as_json(*) + attributes + end + + alias_attribute(:randomNumber, :randomnumber) +end diff --git a/frameworks/Ruby/rage/app/views/fortunes.html.erb b/frameworks/Ruby/rage/app/views/fortunes.html.erb new file mode 100644 index 00000000000..1aa63f3772a --- /dev/null +++ b/frameworks/Ruby/rage/app/views/fortunes.html.erb @@ -0,0 +1,12 @@ + + + Fortunes + + + + <% records.each do |record| %> + + <% end %> +
idmessage
<%= record[:id] %><%= CGI.escape_html(record[:message]) %>
+ + diff --git a/frameworks/Ruby/rage/benchmark_config.json b/frameworks/Ruby/rage/benchmark_config.json new file mode 100755 index 00000000000..04d51d3ca3b --- /dev/null +++ b/frameworks/Ruby/rage/benchmark_config.json @@ -0,0 +1,30 @@ +{ + "framework": "rage", + "tests": [ + { + "default": { + "json_url": "/json", + "plaintext_url": "/plaintext", + "db_url": "/db", + "query_url": "/queries?queries=", + "fortune_url": "/fortunes", + "update_url": "/updates?queries=", + "port": 8080, + "approach": "Realistic", + "classification": "Micro", + "database": "postgres", + "framework": "Rage", + "language": "Ruby", + "flavor": "None", + "orm": "Full", + "platform": "Rack", + "webserver": "Rage-Iodine", + "os": "Linux", + "database_os": "Linux", + "display_name": "Rage", + "notes": "", + "versus": "None" + } + } + ] +} diff --git a/frameworks/Ruby/rage/config.ru b/frameworks/Ruby/rage/config.ru new file mode 100644 index 00000000000..52de8a40479 --- /dev/null +++ b/frameworks/Ruby/rage/config.ru @@ -0,0 +1,4 @@ +require_relative "config/application" + +run Rage.application +Rage.load_middlewares(self) diff --git a/frameworks/Ruby/rage/config/application.rb b/frameworks/Ruby/rage/config/application.rb new file mode 100644 index 00000000000..9af142340b3 --- /dev/null +++ b/frameworks/Ruby/rage/config/application.rb @@ -0,0 +1,14 @@ +require "bundler/setup" +require "rage" +Bundler.require(*Rage.groups) + +require "rage/all" + +Rage.configure do + # use this to add settings that are constant across all environments +end + +require "erb" +require "cgi" + +require "rage/setup" diff --git a/frameworks/Ruby/rage/config/environments/development.rb b/frameworks/Ruby/rage/config/environments/development.rb new file mode 100644 index 00000000000..ba6e1d01423 --- /dev/null +++ b/frameworks/Ruby/rage/config/environments/development.rb @@ -0,0 +1,4 @@ +Rage.configure do + config.server.workers_count = -1 + config.logger = ActiveRecord::Base.logger = Rage::Logger.new(STDOUT) +end diff --git a/frameworks/Ruby/rage/config/environments/production.rb b/frameworks/Ruby/rage/config/environments/production.rb new file mode 100644 index 00000000000..0189c7742fa --- /dev/null +++ b/frameworks/Ruby/rage/config/environments/production.rb @@ -0,0 +1,3 @@ +Rage.configure do + config.logger = nil +end diff --git a/frameworks/Ruby/rage/config/initializers/activerecord.rb b/frameworks/Ruby/rage/config/initializers/activerecord.rb new file mode 100644 index 00000000000..c0e3eb08d44 --- /dev/null +++ b/frameworks/Ruby/rage/config/initializers/activerecord.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +require "etc" + +connection = { + adapter: "postgresql", + host: "tfb-database", + username: "benchmarkdbuser", + password: "benchmarkdbpass", + database: "hello_world", + reaping_frequency: 0, + pool: (2 * Math.log(256 / Etc.nprocessors)).floor +} + +puts "ActiveRecord connection options: #{connection.inspect}" + +ActiveRecord::Base.establish_connection(connection) diff --git a/frameworks/Ruby/rage/config/routes.rb b/frameworks/Ruby/rage/config/routes.rb new file mode 100644 index 00000000000..98def92a7e7 --- /dev/null +++ b/frameworks/Ruby/rage/config/routes.rb @@ -0,0 +1,10 @@ +Rage.routes.draw do + root to: ->(env) { [200, {}, "It works!"] } + + get "json", to: "benchmarks#json" + get "plaintext", to: "benchmarks#plaintext" + get "db", to: "benchmarks#db" + get "queries", to: "benchmarks#queries" + get "fortunes", to: "benchmarks#fortunes" + get "updates", to: "benchmarks#updates" +end diff --git a/frameworks/Ruby/rage/lib/.keep b/frameworks/Ruby/rage/lib/.keep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/frameworks/Ruby/rage/rage.dockerfile b/frameworks/Ruby/rage/rage.dockerfile new file mode 100644 index 00000000000..a1e80a095f3 --- /dev/null +++ b/frameworks/Ruby/rage/rage.dockerfile @@ -0,0 +1,14 @@ +FROM ruby:3.3 + +EXPOSE 8080 +WORKDIR /rage + +COPY Gemfile* /rage/ +RUN bundle install --jobs=8 +COPY . /rage + +ENV RUBY_YJIT_ENABLE=1 +ENV RAGE_PATCH_AR_POOL=1 +ENV BUNDLE_FORCE_RUBY_PLATFORM=true + +CMD bundle exec rage s -b 0.0.0.0 -p 8080 -e production From 79d4e7909d4868033d5246c25ded0278be20ee07 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 20 Jun 2024 16:24:10 +0000 Subject: [PATCH 40/45] Bump io.undertow:undertow-core in /frameworks/Java/undertow-jersey Bumps [io.undertow:undertow-core](https://github.com/undertow-io/undertow) from 2.3.12.Final to 2.3.14.Final. - [Release notes](https://github.com/undertow-io/undertow/releases) - [Commits](https://github.com/undertow-io/undertow/compare/2.3.12.Final...2.3.14.Final) --- updated-dependencies: - dependency-name: io.undertow:undertow-core dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- frameworks/Java/undertow-jersey/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frameworks/Java/undertow-jersey/pom.xml b/frameworks/Java/undertow-jersey/pom.xml index 5be3dd82456..bf4603735ca 100644 --- a/frameworks/Java/undertow-jersey/pom.xml +++ b/frameworks/Java/undertow-jersey/pom.xml @@ -174,7 +174,7 @@ io.undertow undertow-core - 2.3.12.Final + 2.3.14.Final From 57fa858b659f254acad570464374ed92a9a3c787 Mon Sep 17 00:00:00 2001 From: Fangdun Tsai Date: Sat, 29 Jun 2024 00:21:46 +0800 Subject: [PATCH 41/45] [rust/viz] rust v1.79 (#9131) --- frameworks/Rust/viz/Cargo.toml | 4 ++-- frameworks/Rust/viz/viz-diesel.dockerfile | 2 +- frameworks/Rust/viz/viz-pg.dockerfile | 2 +- frameworks/Rust/viz/viz-sqlx.dockerfile | 2 +- frameworks/Rust/viz/viz.dockerfile | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/frameworks/Rust/viz/Cargo.toml b/frameworks/Rust/viz/Cargo.toml index 9832cb58fdb..f28595febb5 100644 --- a/frameworks/Rust/viz/Cargo.toml +++ b/frameworks/Rust/viz/Cargo.toml @@ -42,10 +42,10 @@ sqlx = { version = "0.7", features = [ "runtime-tokio", "tls-native-tls" ], optional = true } -diesel = { version = "2.0", default-features = false, features = [ +diesel = { version = "2.2", default-features = false, features = [ "i-implement-a-third-party-backend-and-opt-into-breaking-changes", ], optional = true } -diesel-async = { version = "0.4", default-features = false, features = [ +diesel-async = { git = "https://github.com/weiznich/diesel_async.git", rev = "74867bd", version = "0.4", default-features = false, features = [ "postgres", "bb8", ], optional = true } diff --git a/frameworks/Rust/viz/viz-diesel.dockerfile b/frameworks/Rust/viz/viz-diesel.dockerfile index c1ddd42ddd5..d37e0af9130 100644 --- a/frameworks/Rust/viz/viz-diesel.dockerfile +++ b/frameworks/Rust/viz/viz-diesel.dockerfile @@ -1,4 +1,4 @@ -FROM rust:1.75 +FROM rust:1.79 RUN apt-get update -yqq && apt-get install -yqq cmake g++ diff --git a/frameworks/Rust/viz/viz-pg.dockerfile b/frameworks/Rust/viz/viz-pg.dockerfile index 69238ff1c62..326f10a3bc6 100644 --- a/frameworks/Rust/viz/viz-pg.dockerfile +++ b/frameworks/Rust/viz/viz-pg.dockerfile @@ -1,4 +1,4 @@ -FROM rust:1.75 +FROM rust:1.79 RUN apt-get update -yqq && apt-get install -yqq cmake g++ diff --git a/frameworks/Rust/viz/viz-sqlx.dockerfile b/frameworks/Rust/viz/viz-sqlx.dockerfile index 087feee3c8e..76104544be0 100644 --- a/frameworks/Rust/viz/viz-sqlx.dockerfile +++ b/frameworks/Rust/viz/viz-sqlx.dockerfile @@ -1,4 +1,4 @@ -FROM rust:1.75 +FROM rust:1.79 RUN apt-get update -yqq && apt-get install -yqq cmake g++ diff --git a/frameworks/Rust/viz/viz.dockerfile b/frameworks/Rust/viz/viz.dockerfile index bf54a7076c9..d6fd457b66e 100644 --- a/frameworks/Rust/viz/viz.dockerfile +++ b/frameworks/Rust/viz/viz.dockerfile @@ -1,4 +1,4 @@ -FROM rust:1.75 +FROM rust:1.79 RUN apt-get update -yqq && apt-get install -yqq cmake g++ From 4398d2cad63279a794bb6ce35449b08ce8cf3208 Mon Sep 17 00:00:00 2001 From: Petrik de Heus Date: Fri, 28 Jun 2024 18:21:56 +0200 Subject: [PATCH 42/45] [ruby|rack-sequel] Batch update for Postgres (#9130) Also remove Rack::Chunked middleware as it is no longer supported. --- frameworks/Ruby/rack-sequel/boot.rb | 34 +++++++++++++++++----- frameworks/Ruby/rack-sequel/config.ru | 1 - frameworks/Ruby/rack-sequel/hello_world.rb | 26 ++++++++--------- 3 files changed, 40 insertions(+), 21 deletions(-) diff --git a/frameworks/Ruby/rack-sequel/boot.rb b/frameworks/Ruby/rack-sequel/boot.rb index e4de89199e9..609e3dacceb 100644 --- a/frameworks/Ruby/rack-sequel/boot.rb +++ b/frameworks/Ruby/rack-sequel/boot.rb @@ -33,8 +33,8 @@ def connect(dbtype) Bundler.require(dbtype) # Load database-specific modules adapters = { - :mysql=>{ :jruby=>'jdbc:mysql', :mri=>'mysql2' }, - :postgresql=>{ :jruby=>'jdbc:postgresql', :mri=>'postgres' } + mysql: { jruby: 'jdbc:mysql', mri: 'mysql2' }, + postgresql: { jruby: 'jdbc:postgresql', mri: 'postgres' } } opts = {} @@ -52,11 +52,11 @@ def connect(dbtype) Sequel.connect \ '%{adapter}://%{host}/%{database}?user=%{user}&password=%{password}' % { - :adapter=>adapters.fetch(dbtype).fetch(defined?(JRUBY_VERSION) ? :jruby : :mri), - :host=>'tfb-database', - :database=>'hello_world', - :user=>'benchmarkdbuser', - :password=>'benchmarkdbpass' + adapter: adapters.fetch(dbtype).fetch(defined?(JRUBY_VERSION) ? :jruby : :mri), + host: 'tfb-database', + database: 'hello_world', + user: 'benchmarkdbuser', + password: 'benchmarkdbpass' }, opts end @@ -64,7 +64,27 @@ def connect(dbtype) # Define ORM models class World < Sequel::Model(:World) + BY_ID = naked.where(id: :$id).prepare(:first, :world_by_id) + UPDATE = where(id: :$id).prepare(:update, :world_update, randomnumber: :$randomnumber) + def_column_alias(:randomnumber, :randomNumber) if DB.database_type == :mysql + + def self.batch_update(worlds) + if DB.database_type == :mysql + worlds.each do |world| + UPDATE.(id: world[:id], randomnumber: world[:randomnumber]) + end + else + ids = [] + sql = String.new("UPDATE world SET randomnumber = CASE id ") + worlds.each do |world| + sql << "when #{world[:id]} then #{world[:randomnumber]} " + ids << world[:id] + end + sql << "ELSE randomnumber END WHERE id IN ( #{ids.join(',')})" + DB.run(sql) + end + end end class Fortune < Sequel::Model(:Fortune) diff --git a/frameworks/Ruby/rack-sequel/config.ru b/frameworks/Ruby/rack-sequel/config.ru index ff84c719d0f..8fceb7c06fc 100644 --- a/frameworks/Ruby/rack-sequel/config.ru +++ b/frameworks/Ruby/rack-sequel/config.ru @@ -1,5 +1,4 @@ require_relative 'boot' require_relative 'hello_world' use Rack::ContentLength -use Rack::Chunked run HelloWorld.new diff --git a/frameworks/Ruby/rack-sequel/hello_world.rb b/frameworks/Ruby/rack-sequel/hello_world.rb index 77525d99e45..d68de1f48d7 100644 --- a/frameworks/Ruby/rack-sequel/hello_world.rb +++ b/frameworks/Ruby/rack-sequel/hello_world.rb @@ -20,17 +20,14 @@ def rand1 rand(MAX_PK).succ end - WORLD_BY_ID = World.naked.where(:id=>:$id).prepare(:first, :world_by_id) - WORLD_UPDATE = World.where(:id=>:$id).prepare(:update, :world_update, :randomnumber=>:$randomnumber) - def db - WORLD_BY_ID.(:id=>rand1) + World::BY_ID.(id: rand1) end def queries(env) DB.synchronize do ALL_IDS.sample(bounded_queries(env)).map do |id| - WORLD_BY_ID.(id: id) + World::BY_ID.(id: id) end end end @@ -38,8 +35,8 @@ def queries(env) def fortunes fortunes = Fortune.all fortunes << Fortune.new( - :id=>0, - :message=>'Additional fortune added at request time.' + id: 0, + message: 'Additional fortune added at request time.' ) fortunes.sort_by!(&:message) @@ -78,11 +75,14 @@ def fortunes def updates(env) DB.synchronize do - ALL_IDS.sample(bounded_queries(env)).map do |id| - world = WORLD_BY_ID.(id: id) - WORLD_UPDATE.(id: world[:id], randomnumber: (world[:randomnumber] = rand1)) - world - end + worlds = + ALL_IDS.sample(bounded_queries(env)).map do |id| + world = World::BY_ID.(id: id) + world[:randomnumber] = rand1 + world + end + World.batch_update(worlds) + worlds end end @@ -91,7 +91,7 @@ def call(env) case env['PATH_INFO'] when '/json' # Test type 1: JSON serialization - [JSON_TYPE, JSON.fast_generate(:message=>'Hello, World!')] + [JSON_TYPE, JSON.fast_generate(message: 'Hello, World!')] when '/db' # Test type 2: Single database query [JSON_TYPE, JSON.fast_generate(db)] From 25862b317e175f95f964d38717fd20fb0434f8e0 Mon Sep 17 00:00:00 2001 From: Petrik de Heus Date: Fri, 28 Jun 2024 18:22:07 +0200 Subject: [PATCH 43/45] [ruby/sinatra-sequel] Use batch update for postgres (#9127) --- frameworks/Ruby/sinatra-sequel/boot.rb | 15 +++++++++++++++ frameworks/Ruby/sinatra-sequel/hello_world.rb | 10 ++++++---- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/frameworks/Ruby/sinatra-sequel/boot.rb b/frameworks/Ruby/sinatra-sequel/boot.rb index 44843e48341..b91ea6e1317 100644 --- a/frameworks/Ruby/sinatra-sequel/boot.rb +++ b/frameworks/Ruby/sinatra-sequel/boot.rb @@ -62,6 +62,21 @@ def connect(dbtype) # Define ORM models class World < Sequel::Model(:World) def_column_alias(:randomnumber, :randomNumber) if DB.database_type == :mysql + + def self.batch_update(worlds) + if DB.database_type == :mysql + worlds.map(&:save_changes) + else + ids = [] + sql = String.new("UPDATE world SET randomnumber = CASE id ") + worlds.each do |world| + sql << "when #{world.id} then #{world.randomnumber} " + ids << world.id + end + sql << "ELSE randomnumber END WHERE id IN ( #{ids.join(',')})" + DB.run(sql) + end + end end class Fortune < Sequel::Model(:Fortune) diff --git a/frameworks/Ruby/sinatra-sequel/hello_world.rb b/frameworks/Ruby/sinatra-sequel/hello_world.rb index ccad94b8303..e04d76a077b 100644 --- a/frameworks/Ruby/sinatra-sequel/hello_world.rb +++ b/frameworks/Ruby/sinatra-sequel/hello_world.rb @@ -78,16 +78,18 @@ def rand1 # Test type 5: Database updates get '/updates' do - worlds = - DB.synchronize do + worlds = nil + DB.synchronize do + worlds = ALL_IDS.sample(bounded_queries).map do |id| world = World.with_pk(id) new_value = rand1 new_value = rand1 while new_value == world.randomnumber - world.update(randomnumber: new_value) + world.randomnumber = new_value world end - end + World.batch_update(worlds) + end json worlds.map!(&:values) end From 635f0686cc2a8a1bf549c3b5aeadadb2ac3ac193 Mon Sep 17 00:00:00 2001 From: Petrik de Heus Date: Fri, 28 Jun 2024 18:22:17 +0200 Subject: [PATCH 44/45] [ruby/roda] Use batch update for Roda on postgres (#9126) --- frameworks/Ruby/roda-sequel/boot.rb | 15 +++++++++++++++ frameworks/Ruby/roda-sequel/hello_world.rb | 14 ++++++++------ 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/frameworks/Ruby/roda-sequel/boot.rb b/frameworks/Ruby/roda-sequel/boot.rb index eafc7bd7932..ebeb5a584c4 100644 --- a/frameworks/Ruby/roda-sequel/boot.rb +++ b/frameworks/Ruby/roda-sequel/boot.rb @@ -73,6 +73,21 @@ def connect(dbtype) # Define ORM models class World < Sequel.Model(:World) def_column_alias(:randomnumber, :randomNumber) if DB.database_type == :mysql + + def self.batch_update(worlds) + if DB.database_type == :mysql + worlds.map(&:save_changes) + else + ids = [] + sql = String.new("UPDATE world SET randomnumber = CASE id ") + worlds.each do |world| + sql << "when #{world.id} then #{world.randomnumber} " + ids << world.id + end + sql << "ELSE randomnumber END WHERE id IN ( #{ids.join(',')})" + DB.run(sql) + end + end end class Fortune < Sequel.Model(:Fortune) diff --git a/frameworks/Ruby/roda-sequel/hello_world.rb b/frameworks/Ruby/roda-sequel/hello_world.rb index abd0d5b1487..6a0a43efccb 100644 --- a/frameworks/Ruby/roda-sequel/hello_world.rb +++ b/frameworks/Ruby/roda-sequel/hello_world.rb @@ -58,17 +58,19 @@ def rand1 # Test type 5: Database updates r.is "updates" do response[CONTENT_TYPE] = JSON_TYPE - worlds = - DB.synchronize do + worlds = [] + DB.synchronize do + worlds = ALL_IDS.sample(bounded_queries).map do |id| world = World.with_pk(id) new_value = rand1 new_value = rand1 while new_value == world.randomnumber - world.update(randomnumber: new_value) - world.values + world.randomnumber = new_value + world end - end - worlds.to_json + World.batch_update(worlds) + end + worlds.map(&:values).to_json end # Test type 6: Plaintext From a8f72550a805a22865cd39e725c4241db65b695f Mon Sep 17 00:00:00 2001 From: Anton Kirilov Date: Fri, 28 Jun 2024 17:22:42 +0100 Subject: [PATCH 45/45] H2O: Use prepared statements for the database updates test (#9124) --- frameworks/C/h2o/src/database.c | 10 +- frameworks/C/h2o/src/database.h | 4 +- frameworks/C/h2o/src/handlers/world.c | 175 +++++++++++++++++--------- 3 files changed, 123 insertions(+), 66 deletions(-) diff --git a/frameworks/C/h2o/src/database.c b/frameworks/C/h2o/src/database.c index 9736cb9f2f0..9c5c843150f 100644 --- a/frameworks/C/h2o/src/database.c +++ b/frameworks/C/h2o/src/database.c @@ -56,8 +56,8 @@ typedef struct { typedef struct { list_t l; - const char *name; - const char *query; + char *name; + char *query; } prepared_statement_t; static h2o_socket_t *create_socket(int sd, h2o_loop_t *loop); @@ -713,8 +713,8 @@ void add_prepared_statement(const char *name, const char *query, list_t **prepar memset(p, 0, sizeof(*p)); p->l.next = *prepared_statements; - p->name = name; - p->query = query; + p->name = h2o_strdup(NULL, name, SIZE_MAX).base; + p->query = h2o_strdup(NULL, query, SIZE_MAX).base; *prepared_statements = &p->l; } @@ -791,6 +791,8 @@ void remove_prepared_statements(list_t *prepared_statements) prepared_statements); prepared_statements = prepared_statements->next; + free(p->name); + free(p->query); free(p); } while (prepared_statements); } diff --git a/frameworks/C/h2o/src/database.h b/frameworks/C/h2o/src/database.h index c0c0ca05eda..160e2ea9abc 100644 --- a/frameworks/C/h2o/src/database.h +++ b/frameworks/C/h2o/src/database.h @@ -49,10 +49,10 @@ typedef struct db_query_param_t { on_result_t on_result; void (*on_timeout)(struct db_query_param_t *); const char *command; - const char * const *paramValues; - const int *paramLengths; const int *paramFormats; + const int *paramLengths; const Oid *paramTypes; + const char * const *paramValues; size_t nParams; uint_fast32_t flags; int resultFormat; diff --git a/frameworks/C/h2o/src/handlers/world.c b/frameworks/C/h2o/src/handlers/world.c index 0ee0b29d497..a87ee4c4282 100644 --- a/frameworks/C/h2o/src/handlers/world.c +++ b/frameworks/C/h2o/src/handlers/world.c @@ -57,17 +57,18 @@ // MAX_UPDATE_QUERY_LEN must be updated whenever UPDATE_QUERY_BEGIN, UPDATE_QUERY_ELEM, // UPDATE_QUERY_MIDDLE, UPDATE_QUERY_ELEM2, and UPDATE_QUERY_END are changed. #define UPDATE_QUERY_BEGIN "UPDATE " WORLD_TABLE_NAME " SET randomNumber = CASE id " -#define UPDATE_QUERY_ELEM "WHEN %" PRIu32 " THEN %" PRIu32 " " -#define UPDATE_QUERY_MIDDLE "ELSE randomNumber END WHERE id IN (%" PRIu32 -#define UPDATE_QUERY_ELEM2 ",%" PRIu32 +#define UPDATE_QUERY_ELEM "WHEN $%zu::integer THEN $%zu::integer " +#define UPDATE_QUERY_MIDDLE "ELSE randomNumber END WHERE id IN ($1::integer" +#define UPDATE_QUERY_ELEM2 ",$%zu::integer" #define UPDATE_QUERY_END ");" #define MAX_UPDATE_QUERY_LEN(n) \ (sizeof(UPDATE_QUERY_BEGIN) + sizeof(UPDATE_QUERY_MIDDLE) + \ sizeof(UPDATE_QUERY_END) - 1 - sizeof(UPDATE_QUERY_ELEM2) + \ (n) * (sizeof(UPDATE_QUERY_ELEM) - 1 + sizeof(UPDATE_QUERY_ELEM2) - 1 + \ - 3 * (sizeof(MKSTR(MAX_ID)) - 1) - 3 * (sizeof(PRIu32) - 1) - 3)) + 3 * sizeof(MKSTR(MAX_QUERIES)) - 3 * (sizeof("%zu") - 1))) +#define UPDATE_QUERY_NAME_PREFIX WORLD_TABLE_NAME "Update" #define USE_CACHE 2 #define WORLD_QUERY "SELECT * FROM " WORLD_TABLE_NAME " WHERE id = $1::integer;" @@ -259,11 +260,16 @@ static int do_multiple_queries(bool do_update, bool use_cache, h2o_req_t *req) size_t sz = base_size + num_query_in_progress * sizeof(query_param_t); if (do_update) { - const size_t reuse_size = (num_query_in_progress - 1) * sizeof(query_param_t); - const size_t update_query_len = MAX_UPDATE_QUERY_LEN(num_query); + size_t s = base_size + sizeof(query_param_t); - if (update_query_len > reuse_size) - sz += update_query_len - reuse_size; + s = (s + _Alignof(const char *) - 1) / _Alignof(const char *); + s = s * _Alignof(const char *) + 2 * num_query * sizeof(const char *); + s = (s + _Alignof(int) - 1) / _Alignof(int); + s = s * _Alignof(int) + 4 * num_query * sizeof(int); + s += sizeof(UPDATE_QUERY_NAME_PREFIX MKSTR(MAX_QUERIES)); + + if (s > sz) + sz = s; } multiple_query_ctx_t * const query_ctx = h2o_mem_alloc(sz); @@ -332,65 +338,57 @@ static int do_multiple_queries(bool do_update, bool use_cache, h2o_req_t *req) static void do_updates(multiple_query_ctx_t *query_ctx) { - char *iter = (char *) (query_ctx->query_param + 1); - size_t sz = MAX_UPDATE_QUERY_LEN(query_ctx->num_result); - - // Sort the results to avoid database deadlock. - qsort(query_ctx->res, query_ctx->num_result, sizeof(*query_ctx->res), compare_items); - query_ctx->query_param->param.command = iter; - query_ctx->query_param->param.nParams = 0; - query_ctx->query_param->param.on_result = on_update_result; - query_ctx->query_param->param.paramFormats = NULL; - query_ctx->query_param->param.paramLengths = NULL; - query_ctx->query_param->param.paramValues = NULL; - query_ctx->query_param->param.flags = 0; + size_t offset = + offsetof(multiple_query_ctx_t, res) + query_ctx->num_result * sizeof(*query_ctx->res); - int c = snprintf(iter, sz, UPDATE_QUERY_BEGIN); - - if ((size_t) c >= sz) - goto error; - - iter += c; - sz -= c; - - for (size_t i = 0; i < query_ctx->num_result; i++) { - query_ctx->res[i].random_number = 1 + get_random_number(MAX_ID, - &query_ctx->ctx->random_seed); - c = snprintf(iter, - sz, - UPDATE_QUERY_ELEM, - query_ctx->res[i].id, - query_ctx->res[i].random_number); + offset = ((offset + _Alignof(query_param_t) - 1) / _Alignof(query_param_t)); + offset = offset * _Alignof(query_param_t) + sizeof(query_param_t); + offset = (offset + _Alignof(const char *) - 1) / _Alignof(const char *); + offset *= _Alignof(const char *); - if ((size_t) c >= sz) - goto error; + const char ** const paramValues = (const char **) ((char *) query_ctx + offset); + const size_t nParams = query_ctx->num_result * 2; - iter += c; - sz -= c; - } + offset += nParams * sizeof(*paramValues); + offset = (offset + _Alignof(int) - 1) / _Alignof(int); + offset *= _Alignof(int); - c = snprintf(iter, sz, UPDATE_QUERY_MIDDLE, query_ctx->res->id); + int * const paramFormats = (int *) ((char *) query_ctx + offset); + int * const paramLengths = paramFormats + nParams; + char * const command = (char *) (paramLengths + nParams); + const size_t command_size = + sizeof(UPDATE_QUERY_NAME_PREFIX MKSTR(MAX_QUERIES)) - sizeof(UPDATE_QUERY_NAME_PREFIX) + 1; + const int c = snprintf(command + sizeof(UPDATE_QUERY_NAME_PREFIX) - 1, + command_size, + "%zu", + query_ctx->num_result); - if ((size_t) c >= sz) + if ((size_t) c >= command_size) goto error; - iter += c; - sz -= c; - - for (size_t i = 1; i < query_ctx->num_result; i++) { - c = snprintf(iter, sz, UPDATE_QUERY_ELEM2, query_ctx->res[i].id); - - if ((size_t) c >= sz) - goto error; - - iter += c; - sz -= c; - } - - c = snprintf(iter, sz, UPDATE_QUERY_END); + memcpy(command, UPDATE_QUERY_NAME_PREFIX, sizeof(UPDATE_QUERY_NAME_PREFIX) - 1); + // Sort the results to avoid database deadlock. + qsort(query_ctx->res, query_ctx->num_result, sizeof(*query_ctx->res), compare_items); - if ((size_t) c >= sz) - goto error; + for (size_t i = 0; i < query_ctx->num_result; i++) { + query_ctx->res[i].id = htonl(query_ctx->res[i].id); + query_ctx->res[i].random_number = + htonl(1 + get_random_number(MAX_ID, &query_ctx->ctx->random_seed)); + paramFormats[2 * i] = 1; + paramFormats[2 * i + 1] = 1; + paramLengths[2 * i] = sizeof(query_ctx->res[i].id); + paramLengths[2 * i + 1] = sizeof(query_ctx->res[i].random_number); + paramValues[2 * i] = (const char *) &query_ctx->res[i].id; + paramValues[2 * i + 1] = (const char *) &query_ctx->res[i].random_number; + } + + query_ctx->query_param->param.command = command; + query_ctx->query_param->param.flags = IS_PREPARED; + query_ctx->query_param->param.nParams = nParams; + query_ctx->query_param->param.on_result = on_update_result; + query_ctx->query_param->param.paramFormats = paramFormats; + query_ctx->query_param->param.paramLengths = paramLengths; + query_ctx->query_param->param.paramValues = paramValues; if (execute_database_query(&query_ctx->ctx->request_handler_data.hello_world_db, &query_ctx->query_param->param)) { @@ -726,8 +724,14 @@ static result_return_t on_update_result(db_query_param_t *param, PGresult *resul query_ctx->gen = get_json_generator(&query_ctx->ctx->json_generator, &query_ctx->ctx->json_generator_num); - if (query_ctx->gen) + if (query_ctx->gen) { + for (size_t i = 0; i < query_ctx->num_result; i++) { + query_ctx->res[i].id = ntohl(query_ctx->res[i].id); + query_ctx->res[i].random_number = ntohl(query_ctx->res[i].random_number); + } + serialize_items(query_ctx->res, query_ctx->num_result, &query_ctx->gen, query_ctx->req); + } else send_error(INTERNAL_SERVER_ERROR, REQ_ERROR, query_ctx->req); } @@ -887,6 +891,57 @@ void initialize_world_handlers(h2o_hostconf_t *hostconf, h2o_access_log_filehandle_t *log_handle, request_handler_data_t *data) { + char name[sizeof(UPDATE_QUERY_NAME_PREFIX MKSTR(MAX_QUERIES))]; + char query[MAX_UPDATE_QUERY_LEN(MAX_QUERIES)]; + const size_t name_size = sizeof(name) - sizeof(UPDATE_QUERY_NAME_PREFIX) + 1; + + assert(sizeof(name) >= sizeof(UPDATE_QUERY_NAME_PREFIX)); + memcpy(name, UPDATE_QUERY_NAME_PREFIX, sizeof(UPDATE_QUERY_NAME_PREFIX) - 1); + assert(sizeof(query) >= sizeof(UPDATE_QUERY_BEGIN)); + memcpy(query, UPDATE_QUERY_BEGIN, sizeof(UPDATE_QUERY_BEGIN) - 1); + + for (size_t i = 0; i < MAX_QUERIES; i++) { + char *iter = query + sizeof(UPDATE_QUERY_BEGIN) - 1; + size_t sz = sizeof(query) - sizeof(UPDATE_QUERY_BEGIN) + 1; + int c = snprintf(name + sizeof(UPDATE_QUERY_NAME_PREFIX) - 1, name_size, "%zu", i + 1); + + if ((size_t) c >= name_size) + continue; + + for (size_t j = 0; j <= i; j++) { + c = snprintf(iter, + sz, + UPDATE_QUERY_ELEM, + 2 * j + 1, + 2 * j + 2); + + if ((size_t) c >= sz) + continue; + + iter += c; + sz -= c; + } + + assert(sz >= sizeof(UPDATE_QUERY_MIDDLE)); + memcpy(iter, UPDATE_QUERY_MIDDLE, sizeof(UPDATE_QUERY_MIDDLE) - 1); + iter += sizeof(UPDATE_QUERY_MIDDLE) - 1; + sz -= sizeof(UPDATE_QUERY_MIDDLE) - 1; + + for (size_t j = 1; j <= i; j++) { + c = snprintf(iter, sz, UPDATE_QUERY_ELEM2, 2 * j + 1); + + if ((size_t) c >= sz) + continue; + + iter += c; + sz -= c; + } + + assert(sz >= sizeof(UPDATE_QUERY_END)); + memcpy(iter, UPDATE_QUERY_END, sizeof(UPDATE_QUERY_END)); + add_prepared_statement(name, query, &data->prepared_statements); + } + add_prepared_statement(WORLD_TABLE_NAME, WORLD_QUERY, &data->prepared_statements); register_request_handler("/cached-worlds", cached_queries, hostconf, log_handle); register_request_handler("/db", single_query, hostconf, log_handle);