Skip to content

Commit

Permalink
Encryption client side (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
ElfoLiNk authored Sep 11, 2020
1 parent 9838f80 commit 9d7990b
Show file tree
Hide file tree
Showing 14 changed files with 703 additions and 238 deletions.
6 changes: 3 additions & 3 deletions docker/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
version: '3'
services:
zookeeper:
image: confluentinc/cp-zookeeper:5.5.0
image: confluentinc/cp-zookeeper:5.5.1
ports:
- 2181:2181
environment:
ZOOKEEPER_CLIENT_PORT: 2181
ZOOKEEPER_TICK_TIME: 2000

kafka:
image: confluentinc/cp-kafka:5.5.0
image: confluentinc/cp-kafka:5.5.1
ports:
- 9092:9092
- 29092:29092
Expand All @@ -25,7 +25,7 @@ services:
- zookeeper

vault:
image: vault:1.4.2
image: vault:1.5.3
restart: always
volumes:
- ./vault/data:/vault/file
Expand Down
2 changes: 1 addition & 1 deletion perf-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ docker-compose -f docker/docker-compose.yaml up -d
echo "Enable Vault Transit"
docker exec -e VAULT_TOKEN="${VAULT_TOKEN}" docker_vault_1 vault secrets enable transit || true

SIZE_IN_BYTES=(10 100 1000 10000 100000)
SIZE_IN_BYTES=(10 100 500 1000 10000 100000)
NUM_RECORDS=50000
TEST_RUN=$((1 + RANDOM % 10))

Expand Down
81 changes: 45 additions & 36 deletions plot_results.py
Original file line number Diff line number Diff line change
@@ -1,43 +1,52 @@
import numpy as np
import matplotlib.pyplot as plt
import os
import glob

import matplotlib.pyplot as plt
import numpy as np


def plot_kafka_output(directory, kind):
numMsg = ""
for TYPE in ["baseline", "interceptor"]:
X = np.empty(0, dtype=float)
Y = np.empty(0, dtype=float)
print(TYPE)
for filename in sorted(glob.iglob(f"{directory}/{kind}-{TYPE}*.txt")):
size = filename.split('-')[-1].split('.')[0]
numMsg = filename.split('-')[-2]
plt.title(f"{kind} perf {numMsg} msgs")
plt.xlabel("Message Size [byte]")
X = np.append(X, size)
print(filename)
with open(filename, 'r') as f:
lines = f.read().splitlines()
last_line = lines[-1]
throughput = "0"
if kind == "producer":
throughput = last_line.split(',')[1].split(' ')[1]
plt.ylabel("records/sec")
else:
throughput = last_line.split(',')[3]
plt.ylabel("MB/sec")
Y = np.append(Y, round(float(throughput), 2))
print(X)
print(Y)
plt.scatter(X, Y, label=f"{TYPE}")

plt.legend()
plt.savefig(f"{directory}/{kind}-{numMsg}.png")
plt.clf()
numMsg = ""
for TYPE in ["baseline", "interceptor"]:
X = np.empty(0, dtype=float)
Y = np.empty(0, dtype=float)
print(TYPE)
#grab last 4 characters of the file name:
def message_size(x):
print(x)
print(x.split("-")[-1].rsplit( ".", 1 )[ 0 ])
return(int(x.split("-")[-1].rsplit( ".", 1 )[ 0 ]))
file_list = glob.iglob(f"{directory}/{kind}-{TYPE}*.txt")
for filename in sorted(file_list, key = message_size):
size = filename.split('-')[-1].split('.')[0]
numMsg = filename.split('-')[-2]
plt.title(f"{kind} perf {numMsg} msgs")
plt.xlabel("Message Size [byte]")
X = np.append(X, size)
print(filename)
with open(filename, 'r') as f:
lines = f.read().splitlines()
last_line = lines[-1]
throughput = "0"
if kind == "producer":
throughput = last_line.split(',')[1].split(' ')[1]
plt.ylabel("records/sec")
else:
throughput = last_line.split(',')[3]
plt.ylabel("MB/sec")
Y = np.append(Y, round(float(throughput), 2))
print(X)
print(Y)
plt.scatter(X, Y, label=f"{TYPE}")

plt.legend()
plt.savefig(f"{directory}/{kind}-{numMsg}.png")
plt.clf()


def main():
plot_kafka_output("results", "producer")
plot_kafka_output("results", "consumer")
plot_kafka_output("results", "producer")
plot_kafka_output("results", "consumer")


if __name__ == "__main__":
main()
main()
59 changes: 56 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@

<main.basedir>${project.basedir}</main.basedir>

<kafka.version>2.5.0</kafka.version>
<kafka.version>2.5.1</kafka.version>

<junit-jupiter.version>5.5.2</junit-jupiter.version>
<junit-jupiter.version>5.6.2</junit-jupiter.version>
<testcontainers.version>1.14.2</testcontainers.version>

<maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version>
Expand All @@ -31,10 +31,20 @@
<version>${kafka.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<!-- <dependency>
<groupId>com.bettercloud</groupId>
<artifactId>vault-java-driver</artifactId>
<version>5.1.0</version>
</dependency>-->
<dependency>
<groupId>org.springframework.vault</groupId>
<artifactId>spring-vault-core</artifactId>
<version>2.2.2.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-crypto</artifactId>
<version>5.3.4.RELEASE</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
Expand Down Expand Up @@ -66,6 +76,12 @@
<version>1.19.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20171018</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
Expand Down Expand Up @@ -100,6 +116,43 @@
</executions>

</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0-M3</version>
<executions>
<execution>
<id>enforce-maven</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireMavenVersion>
<version>3.1.0</version>
</requireMavenVersion>
</rules>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.8.1</version>
<configuration>
<rulesUri>file:///${project.basedir}/rules.xml</rulesUri>
</configuration>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>display-dependency-updates</goal>
<goal>display-plugin-updates</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
15 changes: 15 additions & 0 deletions rules.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<ruleset xmlns="http://mojo.codehaus.org/versions-maven-plugin/rule/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" comparisonMethod="maven" xsi:schemaLocation="http://mojo.codehaus.org/versions-maven-plugin/rule/2.0.0 http://mojo.codehaus.org/versions-maven-plugin/xsd/rule-2.0.0.xsd">
<ignoreVersions>
<!-- Ignore Alpha's, Beta's, release candidates and milestones -->
<ignoreVersion type="regex">(?i).*Alpha(?:-?\d+)?</ignoreVersion>
<ignoreVersion type="regex">(?i).*a(?:-?\d+)?</ignoreVersion>
<ignoreVersion type="regex">(?i).*Beta(?:-?\d+)?</ignoreVersion>
<ignoreVersion type="regex">(?i).*-B(?:-?\d+)?</ignoreVersion>
<ignoreVersion type="regex">(?i).*RC(?:-?\d+)?</ignoreVersion>
<ignoreVersion type="regex">(?i).*CR(?:-?\d+)?</ignoreVersion>
<ignoreVersion type="regex">(?i).*M(?:-?\d+)?</ignoreVersion>
</ignoreVersions>
<rules>
</rules>
</ruleset>
Loading

0 comments on commit 9d7990b

Please sign in to comment.