Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

30 servlet support http2 #40

Merged
merged 43 commits into from
Jun 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
d21c854
gh-30 update processor
Unknow0 Feb 8, 2024
2106143
Merge branch 'master' of github.com:Unknow0/unknow-server into 30-ser…
Unknow0 Feb 8, 2024
c229cbc
gh-30 refactor
Unknow0 Mar 24, 2024
508cb72
gh-30 fix dependencies
Unknow0 Mar 24, 2024
12495d0
Merge branch 'master' of [email protected]:Unknow0/unknow-server.git into
Unknow0 Mar 24, 2024
341c309
gh-30 some fix
Unknow0 Mar 24, 2024
aa3438c
gh-30 more fixes
Unknow0 Mar 24, 2024
08c70ba
gh-30 update bensh workflow
Unknow0 Mar 24, 2024
342c6c2
gh-30 update bensh workflow
Unknow0 Mar 24, 2024
e880a9a
gh-30 fix some more
Unknow0 Mar 24, 2024
1b5a65f
gh-30 fix bench
Unknow0 Mar 24, 2024
b65d80a
gh-30 fix workflow
Unknow0 Mar 24, 2024
5c32bc0
gh-30 update workflow
Unknow0 Mar 24, 2024
398bcbc
gh-30 http1 fix keep-alive
Unknow0 Mar 26, 2024
39baa92
gh-30 cleanup
Unknow0 Mar 26, 2024
e65c3e4
gh-30 ??
Unknow0 Mar 26, 2024
edf0396
gh-30 update ?
Unknow0 Apr 7, 2024
ee42041
gh-30 update
Unknow0 Apr 14, 2024
29b5594
gh-30 fix the errors ?
Unknow0 Apr 15, 2024
99f1564
gh-30 update & cleanup
Unknow0 Apr 16, 2024
20f0cbc
gh-30 update test
Unknow0 Apr 16, 2024
0b5c05a
gh-30 fix last error ?
Unknow0 May 19, 2024
2870a0c
gh-30 update support for http2
Unknow0 Jun 14, 2024
2050f2b
gh-30 enable http2 on tomcat & update bench
Unknow0 Jun 14, 2024
d6b6a15
gh-30 fix memory leak
Unknow0 Jun 15, 2024
9ff95b3
gh-30 remove native image test
Unknow0 Jun 15, 2024
0d49116
gh-30 fix some infinite loop
Unknow0 Jun 15, 2024
9ee8d12
gh-30 various sonar issue fix
Unknow0 Jun 16, 2024
0712f54
gh-30 cleanup & reorder
Unknow0 Jun 21, 2024
2410cde
gh-30 fix race condition & update htt2 load test
Unknow0 Jun 22, 2024
49342c4
gh-30 fix report
Unknow0 Jun 22, 2024
dbf4890
gh-30 fix header encoding
Unknow0 Jun 23, 2024
047761a
gh-30 add huffman coding for header
Unknow0 Jun 23, 2024
2a1f78e
gh-30 add log
Unknow0 Jun 24, 2024
2670938
gh-30 update
Unknow0 Jun 24, 2024
08807f4
gh-30 put back debug log
Unknow0 Jun 24, 2024
bb1e47d
gh-30 put log in info
Unknow0 Jun 24, 2024
cf60a79
gh-30 remove logs
Unknow0 Jun 24, 2024
091f6aa
gh-30 add log
Unknow0 Jun 24, 2024
9b4aa47
gh-30 fix some synchronization issues
Unknow0 Jun 28, 2024
a713df7
Merge branch 'master' of [email protected]:Unknow0/unknow-server.git into
Unknow0 Jun 28, 2024
bd92dbe
gh-30 fix some code duplication
Unknow0 Jun 29, 2024
a47867e
gh-30 clean code
Unknow0 Jun 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 30 additions & 4 deletions .github/workflows/bench.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,12 @@ jobs:
- name: build native image
run: native-image --install-exit-handlers --static --no-fallback -jar unknow-server-test/unknow-server-test-jar/target/server.jar server-native

- name: bench
run: java -jar unknow-server-bench/target/benchmark.jar

- uses: actions/upload-artifact@v4
if: always()
with:
name: bench
path: unknow-server-bench/target/benchmark.jar
- uses: actions/upload-artifact@v4
if: always()
with:
Expand All @@ -32,6 +35,27 @@ jobs:
server-native
unknow-server-test/*/target/*.war

bench:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/download-artifact@v4
with:
name: bench
- uses: graalvm/setup-graalvm@v1
with:
version: latest
java-version: 11
components: native-image
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: bench
run: java -jar benchmark.jar
- uses: actions/upload-artifact@v4
if: always()
with:
name: results-bench
path: bench.log

test:
runs-on: ubuntu-latest
strategy:
Expand Down Expand Up @@ -69,7 +93,7 @@ jobs:

result:
runs-on: ubuntu-latest
needs: test
needs: [test, bench]
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
Expand All @@ -78,4 +102,6 @@ jobs:
path: out/
merge-multiple: true
- name: result
run: bash bench/result.sh out
run: |
cat out/bench.log
bash bench/result.sh out
4 changes: 4 additions & 0 deletions bench/prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ VER=$(wget -q -O - "https://dlcdn.apache.org/tomcat/tomcat-$TOMCAT/" | grep "<a
mkdir -p tomcat
wget -O - https://dlcdn.apache.org/tomcat/tomcat-$TOMCAT/v$VER/bin/apache-tomcat-$VER.tar.gz | tar xzf - --strip-components=1 -C tomcat
rm -r tomcat/webapps/*
cp bench/server.xml tomcat/conf/

VER=$(wget -q -O - https://archive.apache.org/dist/jmeter/binaries/ | grep -Po '(?<=>apache-jmeter-).*(?=.tgz)' | sort -rV | head -1)
mkdir -p jmeter
wget -O - https://archive.apache.org/dist/jmeter/binaries/apache-jmeter-$VER.tgz | tar xzf - --strip-components=1 -C jmeter
Expand All @@ -17,3 +19,5 @@ mkdir -p logs

# avoid going out of ephemeral port
sudo sysctl net.ipv4.tcp_tw_reuse=1

sudo apt install nghttp2-client
12 changes: 11 additions & 1 deletion bench/result.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ parse()
done < <(sort -t , -r -k 3,1n "$1" | sort -t , -k 3 -u)
}

for i in $1/*; do echo $i; time parse "$i"; done
for i in $1/*.csv; do parse "$i"; done

echo
echo 'throughput:'
Expand Down Expand Up @@ -60,3 +60,13 @@ do
for n in "${!tests[@]}"; do printf ' %10s' "${error[$s:$n]:-0}"; done
echo
done

echo
echo "Http2 result"

for s in "${!servers[@]}"
do
echo
echo "$s"
tail -n 9 "$1/$s.log"
done
10 changes: 7 additions & 3 deletions bench/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,14 @@ trap '[[ "$pid" ]] && kill -9 $pid' EXIT

${1}_start
sleep 10
echo "Warming up"
echo -e "\nWarming up"
$JMETER -n -t bench/test.jmx -Jhost=127.0.0.1 -Jt=20 -Jport=8080 -Jout=/dev/null
sleep 10
echo "Testing.."
$JMETER -n -t bench/test.jmx -Jhost=127.0.0.1 -Jt=60 -Jport=8080 -Jout=out/$1.csv
echo -e "\nTesting.."
$JMETER -n -t bench/test.jmx -Jhost=127.0.0.1 -Jt=60 -Jc=10 -Jport=8080 -Jout=out/$1.csv

echo -e "\n launch http2 bench"
h2load -c 10 -t 10 -m 10 -D 60 --warm-up-time=10 http://127.0.0.1:8080/test > out/$1.log

${1}_stop
sleep 10
53 changes: 53 additions & 0 deletions bench/server.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -->
<!-- Note: A "Server" is not itself a "Container", so you may not define subcomponents such as "Valves" at this level. Documentation at /docs/config/server.html -->
<Server port="8005" shutdown="SHUTDOWN">
<Listener className="org.apache.catalina.startup.VersionLoggerListener" />
<!-- Security listener. Documentation at /docs/config/listeners.html <Listener className="org.apache.catalina.security.SecurityListener" /> -->
<!-- APR library loader. Documentation at /docs/apr.html -->
<Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
<!-- Prevent memory leaks due to use of particular java/javax APIs -->
<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" />
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener" />

<!-- Global JNDI resources Documentation at /docs/jndi-resources-howto.html -->
<GlobalNamingResources>
<!-- Editable user database that can also be used by UserDatabaseRealm to authenticate users -->
<Resource name="UserDatabase" auth="Container" type="org.apache.catalina.UserDatabase" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" pathname="conf/tomcat-users.xml" />
</GlobalNamingResources>

<!-- A "Service" is a collection of one or more "Connectors" that share a single "Container" Note: A "Service" is not itself a "Container", so you may not define subcomponents such as "Valves" at this level. Documentation at /docs/config/service.html -->
<Service name="Catalina">

<!--The connectors can use a shared executor, you can define one or more named thread pools -->
<!-- <Executor name="tomcatThreadPool" namePrefix="catalina-exec-" maxThreads="150" minSpareThreads="4"/> -->


<!-- A "Connector" represents an endpoint by which requests are received and responses are returned. Documentation at : HTTP Connector: /docs/config/http.html AJP Connector: /docs/config/ajp.html Define a non-SSL/TLS HTTP/1.1 Connector on port 8080 -->
<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" maxParameterCount="1000">
<UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol" />
</Connector>
<Engine name="Catalina" defaultHost="localhost">

<!--For clustering, please take a look at documentation at: /docs/cluster-howto.html (simple how to) /docs/config/cluster.html (reference documentation) -->
<!-- <Cluster className="org.apache.catalina.ha.tcp.SimpleTcpCluster"/> -->

<!-- Use the LockOutRealm to prevent attempts to guess user passwords via a brute-force attack -->
<Realm className="org.apache.catalina.realm.LockOutRealm">
<!-- This Realm uses the UserDatabase configured in the global JNDI resources under the key "UserDatabase". Any edits that are performed against this UserDatabase are immediately available for use by the Realm. -->
<Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase" />
</Realm>

<Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true">

<!-- SingleSignOn valve, share authentication between web applications Documentation at: /docs/config/valve.html -->
<!-- <Valve className="org.apache.catalina.authenticator.SingleSignOn" /> -->

<!-- Access log processes all example. Documentation at: /docs/config/valve.html Note: The pattern used is equivalent to using pattern="common" -->
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="localhost_access_log" suffix=".txt" pattern="%h %l %u %t &quot;%r&quot; %s %b" />

</Host>
</Engine>
</Service>
</Server>
Loading