Skip to content

Commit 1bf29f0

Browse files
authored
Merge branch 'TechEmpower:master' into tio-boot
2 parents 805e3ca + 6d87e55 commit 1bf29f0

File tree

8 files changed

+27
-14
lines changed

8 files changed

+27
-14
lines changed

frameworks/Java/avaje-jex/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
<dependency>
5959
<groupId>org.postgresql</groupId>
6060
<artifactId>postgresql</artifactId>
61-
<version>42.7.5</version>
61+
<version>42.7.6</version>
6262
</dependency>
6363

6464
<dependency>

frameworks/Java/avaje-jex/src/main/java/benchmark/repository/HikariFactory.java

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import io.avaje.config.Config;
66
import io.avaje.inject.Bean;
77
import io.avaje.inject.Factory;
8+
import java.util.concurrent.Executors;
89
import javax.sql.DataSource;
910

1011
@Factory
@@ -22,8 +23,21 @@ DataSource dataSource() {
2223
maxPoolSize = Config.getInt("postgresDefaultPoolSize");
2324
}
2425

25-
var hikari = new HikariDataSource(new HikariConfig("hikari.properties"));
26-
hikari.setMaximumPoolSize(maxPoolSize);
27-
return hikari;
26+
maxPoolSize = Math.max(maxPoolSize, Runtime.getRuntime().availableProcessors() * 2);
27+
HikariConfig hikariConfig = new HikariConfig("hikari.properties");
28+
29+
var vtThreadFactory = Thread.ofVirtual().factory();
30+
hikariConfig.setThreadFactory(vtThreadFactory);
31+
hikariConfig.setScheduledExecutor(
32+
Executors.newScheduledThreadPool(maxPoolSize, vtThreadFactory));
33+
34+
// data source properties
35+
hikariConfig.addDataSourceProperty("cachePrepStmts", "true");
36+
hikariConfig.addDataSourceProperty("prepStmtCacheSize", "250");
37+
hikariConfig.addDataSourceProperty("prepStmtCacheSqlLimit", "2048");
38+
hikariConfig.addDataSourceProperty("ssl", "false");
39+
hikariConfig.addDataSourceProperty("tcpKeepAlive", "true");
40+
hikariConfig.setMaximumPoolSize(maxPoolSize);
41+
return new HikariDataSource(hikariConfig);
2842
}
2943
}

frameworks/Java/avaje-jex/src/main/java/benchmark/repository/JDBCDbService.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public JDBCDbService(DataSource connectionFactory) {
2222
}
2323

2424
@Override
25-
public List<World> getWorld(int num) {
25+
public List<World> getWorld(int num) throws SQLException {
2626

2727
String select = "select id, randomNumber from World where id = ?";
2828
List<World> worldList = new ArrayList<>();
@@ -37,8 +37,6 @@ public List<World> getWorld(int num) {
3737
worldList.add(new World(rs.getInt("id"), rs.getInt("randomNumber")));
3838
}
3939
}
40-
} catch (SQLException e) {
41-
throw new RuntimeException(e);
4240
}
4341

4442
return worldList;
@@ -55,7 +53,7 @@ public List<Fortune> getFortune() throws SQLException {
5553
ResultSet rs = pstm.executeQuery()) {
5654

5755
while (rs.next()) {
58-
fortuneList.add(new Fortune(rs.getInt("id"), rs.getString("message")));
56+
fortuneList.add(new Fortune(rs.getInt(1), rs.getString(2)));
5957
}
6058
fortuneList.add(new Fortune(defaultFortuneId, defaultFortuneMessage));
6159
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
physicalTag=Citrine
22
cloudTag=Azure
33

4-
postgresPhysicalPoolSize=56
4+
postgresPhysicalPoolSize=64
55
postgresCloudPoolSize=16
66
postgresDefaultPoolSize=10

frameworks/Java/avaje-jex/src/main/resources/hikari.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
dataSourceClassName=org.postgresql.ds.PGSimpleDataSource
1+
jdbcUrl=jdbc:postgresql://tfb-database:5432/hello_world
22
dataSource.serverName=tfb-database
33
dataSource.portNumber=5432
44
dataSource.user=benchmarkdbuser

frameworks/PHP/laravel/app/Http/Controllers/Controller.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ public function updates($queries = 1)
5252

5353
while ($queries--) {
5454
$row = World::query()->find(self::randomInt());
55-
$row->randomNumber = self::randomInt();
55+
while (($randomInt = self::randomInt()) === $row->randomNumber) {}
56+
$row->randomNumber = $randomInt;
5657
$row->save();
5758

5859
$rows[] = $row;

frameworks/Ruby/rack-sequel/Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ source 'https://rubygems.org'
22

33
gem 'json', '~> 2.8'
44
gem 'sequel', '~> 5.0'
5-
gem 'rack', '~> 3.0'
5+
gem 'rack', '~> 3.1'
66

77
group :mysql, optional: true do
88
gem 'mysql2', '~> 0.4', platforms: [:ruby, :mswin]

frameworks/Ruby/rack-sequel/Gemfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ GEM
88
pg (1.5.9)
99
puma (6.6.0)
1010
nio4r (~> 2.0)
11-
rack (3.1.11)
11+
rack (3.1.16)
1212
sequel (5.90.0)
1313
bigdecimal
1414
sequel_pg (1.17.1)
@@ -25,7 +25,7 @@ DEPENDENCIES
2525
mysql2 (~> 0.4)
2626
pg (~> 1.5)
2727
puma (~> 6.5)
28-
rack (~> 3.0)
28+
rack (~> 3.1)
2929
sequel (~> 5.0)
3030
sequel_pg (~> 1.6)
3131

0 commit comments

Comments
 (0)