Skip to content

Commit c549cb8

Browse files
committed
Remove synchronisation and increase buffer size.
1 parent 57d9871 commit c549cb8

File tree

4 files changed

+13
-17
lines changed

4 files changed

+13
-17
lines changed

deploy/tasks/buildah-oci-ta.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ spec:
142142
- name: BYTE_BUFFER_SIZE
143143
description: The byte buffer size to use for the domain proxy.
144144
type: string
145-
default: 1024
145+
default: 2048
146146
- name: PROXY_TARGET_WHITELIST
147147
description: Comma separated whitelist of target hosts for the domain proxy.
148148
type: string
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
client-domain-socket=${DOMAIN_SOCKET:/tmp/domain-server}
22
client-http-port=8080
3-
byte-buffer-size=${BYTE_BUFFER_SIZE:1024}
3+
byte-buffer-size=${BYTE_BUFFER_SIZE:2048}
44
quarkus.log.min-level=ALL
55
quarkus.log.level=ALL
66
quarkus.log.console.format=%d{yyyy-MM-dd HH:mm:ss,SSS} [Domain Proxy Client] %-5p [%c{3.}] (%t) %s%e%n

java-components/domain-proxy/common/src/main/java/com/redhat/hacbs/domainproxy/common/CommonIOUtil.java

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,10 @@ public static Runnable createSocketToChannelWriter(final int byteBufferSize, fin
2525
LOG.info("Writing from socket to channel");
2626
try {
2727
while ((r = socket.getInputStream().read(buf)) > 0) {
28-
synchronized (channel) {
29-
LOG.infof("Read %d bytes from socket", r);
30-
channel.write(ByteBuffer.wrap(buf, 0, r));
31-
LOG.infof("Wrote %d bytes to channel", r);
32-
bytesWritten += r;
33-
}
28+
LOG.infof("Read %d bytes from socket", r);
29+
channel.write(ByteBuffer.wrap(buf, 0, r));
30+
LOG.infof("Wrote %d bytes to channel", r);
31+
bytesWritten += r;
3432
}
3533
} catch (final ClosedChannelException ignore) {
3634
LOG.info("Channel closed");
@@ -68,14 +66,12 @@ public static Runnable createChannelToSocketWriter(final int byteBufferSize, fin
6866
LOG.info("Writing from channel to socket");
6967
try {
7068
while ((r = channel.read(buf)) > 0) {
71-
synchronized (socket) {
72-
LOG.infof("Read %d bytes from channel", r);
73-
buf.flip();
74-
socket.getOutputStream().write(buf.array(), buf.arrayOffset(), buf.remaining());
75-
LOG.infof("Wrote %d bytes to socket", r);
76-
buf.clear();
77-
bytesWritten += r;
78-
}
69+
LOG.infof("Read %d bytes from channel", r);
70+
buf.flip();
71+
socket.getOutputStream().write(buf.array(), buf.arrayOffset(), buf.remaining());
72+
LOG.infof("Wrote %d bytes to socket", r);
73+
buf.clear();
74+
bytesWritten += r;
7975
}
8076
} catch (final ClosedChannelException ignore) {
8177
LOG.info("Channel closed");

java-components/domain-proxy/server/src/main/resources/application.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
server-domain-socket=${DOMAIN_SOCKET:/tmp/domain-server}
22
server-http-port=2000
3-
byte-buffer-size=${BYTE_BUFFER_SIZE:1024}
3+
byte-buffer-size=${BYTE_BUFFER_SIZE:2048}
44
proxy-target-whitelist=${PROXY_TARGET_WHITELIST:repo.maven.apache.org,repository.jboss.org,packages.confluent.io,jitpack.io,repo.gradle.org,plugins.gradle.org}
55
quarkus.rest-client.proxy-address=${INTERNAL_PROXY_ADDRESS:indy-generic-proxy:80}
66
quarkus.rest-client.proxy-user=${INTERNAL_PROXY_USER}

0 commit comments

Comments
 (0)