Skip to content

Commit b31907b

Browse files
authored
Merge branch 'TechEmpower:master' into master
2 parents ee82731 + e279c64 commit b31907b

35 files changed

+423
-150
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
.dub
2+
docs.json
3+
__dummy.html
4+
docs/
5+
/photon-http
6+
photon-http.so
7+
photon-http.dylib
8+
photon-http.dll
9+
photon-http.a
10+
photon-http.lib
11+
photon-http-test-*
12+
*.exe
13+
*.pdb
14+
*.o
15+
*.obj
16+
*.lst

frameworks/D/photon-http/README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# photon-http benchmark
2+
3+
A benchmark for photon fiber scheduler for D running with minimalistic http server library photon-http.
4+
5+
# photon-http Benchmarking Test
6+
7+
### Test Type Implementation Source Code
8+
9+
* [JSON](./source/app.d)
10+
* [PLAINTEXT](./source/app.d)
11+
12+
## Important Libraries
13+
The tests were run with:
14+
* [photon](https://github.com/DmitryOlshansky/photon)
15+
* [photon-http][https://github.com/DmitryOlshansky/photon-http]
16+
17+
## Test URLs
18+
19+
### JSON
20+
21+
http://localhost:8080/json
22+
23+
### PLAINTEXT
24+
25+
http://localhost:8080/plaintext
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"framework": "photon-http",
3+
"tests": [
4+
{
5+
"default": {
6+
"json_url": "/json",
7+
"plaintext_url": "/plaintext",
8+
"port": 8080,
9+
"approach": "Realistic",
10+
"classification": "Platform",
11+
"database": "None",
12+
"framework": "None",
13+
"language": "D",
14+
"flavor": "None",
15+
"orm": "None",
16+
"platform": "None",
17+
"webserver": "None",
18+
"os": "Linux",
19+
"database_os": "Linux",
20+
"display_name": "photon-http",
21+
"notes": "",
22+
"versus": "None"
23+
}
24+
}
25+
]
26+
}

frameworks/D/photon-http/dub.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"authors": [
3+
"Dmitry Olshansky"
4+
],
5+
"copyright": "Copyright © 2025, Dmitry Olshansky",
6+
"dependencies": {
7+
"asdf": "~>0.7.17",
8+
"photon": "~>0.14.3",
9+
"photon-http": "~>0.5.5"
10+
},
11+
"description": "Benchmark of photon-http",
12+
"license": "BSL-1.0",
13+
"name": "photon-http-benchmark"
14+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
FROM dlangdockerized/ldc
2+
3+
4+
WORKDIR /app
5+
6+
COPY . .
7+
8+
RUN dub build -b release --compiler=ldc2
9+
10+
EXPOSE 8080
11+
12+
CMD ["/app/photon-http-benchmark"]
13+
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
import std.stdio;
2+
import std.socket;
3+
import std.array;
4+
5+
import asdf.serialization;
6+
7+
import photon, photon.http;
8+
9+
struct Message
10+
{
11+
string message;
12+
}
13+
14+
class BenchmarkProcessor : HttpProcessor {
15+
HttpHeader[] plainText = [HttpHeader("Content-Type", "text/plain; charset=utf-8")];
16+
HttpHeader[] json = [HttpHeader("Content-Type", "application/json")];
17+
Appender!(char[]) jsonBuf;
18+
this(Socket sock) {
19+
super(sock);
20+
jsonBuf = appender!(char[]);
21+
}
22+
23+
override void handle(HttpRequest req) {
24+
if (req.uri == "/plaintext") {
25+
respondWith("Hello, world!", 200, plainText);
26+
} else if(req.uri == "/json") {
27+
jsonBuf.clear();
28+
Message("Hello, World!").serializeToJsonPretty!""(jsonBuf);
29+
respondWith(jsonBuf.data, 200, json);
30+
} else {
31+
respondWith("Not found", 404, plainText);
32+
}
33+
}
34+
}
35+
36+
void server_worker(Socket client) {
37+
scope processor = new BenchmarkProcessor(client);
38+
try {
39+
processor.run();
40+
}
41+
catch(Exception e) {
42+
debug stderr.writeln(e);
43+
}
44+
}
45+
46+
void server() {
47+
Socket server = new TcpSocket();
48+
server.setOption(SocketOptionLevel.SOCKET, SocketOption.REUSEADDR, true);
49+
server.bind(new InternetAddress("0.0.0.0", 8080));
50+
server.listen(1000);
51+
52+
debug writeln("Started server");
53+
54+
void processClient(Socket client) {
55+
go(() => server_worker(client));
56+
}
57+
58+
while(true) {
59+
try {
60+
debug writeln("Waiting for server.accept()");
61+
Socket client = server.accept();
62+
debug writeln("New client accepted");
63+
processClient(client);
64+
}
65+
catch(Exception e) {
66+
writefln("Failure to accept %s", e);
67+
}
68+
}
69+
}
70+
71+
void main() {
72+
startloop();
73+
go(() => server());
74+
runFibers();
75+
}

frameworks/Java/gemini/servlet/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
<dependency>
3030
<groupId>org.postgresql</groupId>
3131
<artifactId>postgresql</artifactId>
32-
<version>42.2.5</version>
32+
<version>42.7.2</version>
3333
</dependency>
3434
<dependency>
3535
<groupId>com.techempower</groupId>

0 commit comments

Comments
 (0)