-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #141 from NitorCreations/perf-test-pr
First version of performance test tools
- Loading branch information
Showing
25 changed files
with
1,655 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
eclipse.preferences.version=1 | ||
encoding//src/main/java=UTF-8 | ||
encoding//src/main/resources=UTF-8 | ||
encoding//src/test/java=UTF-8 | ||
encoding//src/test/resources=UTF-8 | ||
encoding/<project>=UTF-8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
eclipse.preferences.version=1 | ||
line.separator=\n |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
eclipse.preferences.version=1 | ||
editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true | ||
formatter_profile=_nflow-engine | ||
formatter_settings_version=12 | ||
sp_cleanup.add_default_serial_version_id=true | ||
sp_cleanup.add_generated_serial_version_id=false | ||
sp_cleanup.add_missing_annotations=true | ||
sp_cleanup.add_missing_deprecated_annotations=true | ||
sp_cleanup.add_missing_methods=false | ||
sp_cleanup.add_missing_nls_tags=false | ||
sp_cleanup.add_missing_override_annotations=true | ||
sp_cleanup.add_missing_override_annotations_interface_methods=true | ||
sp_cleanup.add_serial_version_id=false | ||
sp_cleanup.always_use_blocks=true | ||
sp_cleanup.always_use_parentheses_in_expressions=false | ||
sp_cleanup.always_use_this_for_non_static_field_access=false | ||
sp_cleanup.always_use_this_for_non_static_method_access=false | ||
sp_cleanup.convert_functional_interfaces=false | ||
sp_cleanup.convert_to_enhanced_for_loop=false | ||
sp_cleanup.correct_indentation=false | ||
sp_cleanup.format_source_code=true | ||
sp_cleanup.format_source_code_changes_only=true | ||
sp_cleanup.insert_inferred_type_arguments=false | ||
sp_cleanup.make_local_variable_final=false | ||
sp_cleanup.make_parameters_final=false | ||
sp_cleanup.make_private_fields_final=true | ||
sp_cleanup.make_type_abstract_if_missing_method=false | ||
sp_cleanup.make_variable_declarations_final=true | ||
sp_cleanup.never_use_blocks=false | ||
sp_cleanup.never_use_parentheses_in_expressions=true | ||
sp_cleanup.on_save_use_additional_actions=true | ||
sp_cleanup.organize_imports=true | ||
sp_cleanup.qualify_static_field_accesses_with_declaring_class=false | ||
sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true | ||
sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true | ||
sp_cleanup.qualify_static_member_accesses_with_declaring_class=false | ||
sp_cleanup.qualify_static_method_accesses_with_declaring_class=false | ||
sp_cleanup.remove_private_constructors=true | ||
sp_cleanup.remove_redundant_type_arguments=false | ||
sp_cleanup.remove_trailing_whitespaces=true | ||
sp_cleanup.remove_trailing_whitespaces_all=true | ||
sp_cleanup.remove_trailing_whitespaces_ignore_empty=false | ||
sp_cleanup.remove_unnecessary_casts=true | ||
sp_cleanup.remove_unnecessary_nls_tags=false | ||
sp_cleanup.remove_unused_imports=false | ||
sp_cleanup.remove_unused_local_variables=false | ||
sp_cleanup.remove_unused_private_fields=true | ||
sp_cleanup.remove_unused_private_members=false | ||
sp_cleanup.remove_unused_private_methods=true | ||
sp_cleanup.remove_unused_private_types=true | ||
sp_cleanup.sort_members=false | ||
sp_cleanup.sort_members_all=false | ||
sp_cleanup.use_anonymous_class_creation=false | ||
sp_cleanup.use_blocks=false | ||
sp_cleanup.use_blocks_only_for_return_and_throw=false | ||
sp_cleanup.use_lambda=false | ||
sp_cleanup.use_parentheses_in_expressions=false | ||
sp_cleanup.use_this_for_non_static_field_access=false | ||
sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true | ||
sp_cleanup.use_this_for_non_static_method_access=false | ||
sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true | ||
sp_cleanup.use_type_arguments=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
activeProfiles= | ||
eclipse.preferences.version=1 | ||
resolveWorkspaceProjects=true | ||
version=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
nFlow performance testing | ||
========================= | ||
|
||
- `ansible/` directory contains [Ansible](http://www.ansible.com/) scripts for setting up AWS performance test environment | ||
- `com.nitorcreations.nflow.performance.client and .server` packages contain performance test client and server implementations | ||
- `com.nitorcreations.nflow.performance.testdata` package contains tools for generating data for performance testing | ||
- `com.nitorcreations.nflow.performance.workflow` package contains workflow definitions that are utilized by other packages | ||
|
||
**Generate data for performance testing** | ||
|
||
Test data is created by `NflowPerfTestServer`, when it is started with `generateTestData` argument. The test data generation process is controlled through the following properties: | ||
- `testdata.target.count` - amount of generated workflow instances (default 100000) | ||
- `testdata.batch.size` - size of batch in which generated workflow instances are inserted into database (default 10000) | ||
|
||
`NflowPerfTestServer` will not process workflow instances when started with `generateTestData` argument (nflow.autostart=false). | ||
|
||
Example: generate 1000000 workflow instances | ||
``` | ||
java -Dnflow.db.user=nflow -Dnflow.db.password=nflownflow | ||
-Dnflow.db.postgresql.url=jdbc:postgresql://<your_rds_database>:5432/nflow?tcpKeepAlive=true | ||
-Dnflow.executor.group=nflow-perf -Dnflow.non_spring_workflows_filename=workflows.txt | ||
-Dspring.profiles.active=nflow.db.postgresql -Dtestdata.target.count=1000000 | ||
-jar nflow/nflow-perf-test/target/nflow-perf-tests-*-SNAPSHOT.jar generateTestData | ||
``` | ||
|
||
**Setup AWS environment using Ansible.** | ||
|
||
1. Install Ansible to your workstation | ||
* configure AWS access and secret keys ([see instructions](https://aws.amazon.com/blogs/apn/getting-started-with-ansible-and-dynamic-amazon-ec2-inventory-management/)) | ||
* copy your AWS private key file to nflow-perf-test/ansible directory | ||
|
||
2. Configure Ansible with your AWS account details (nflow-perf-test/ansible/vars/perf-test-environment.yml) | ||
* ec2_region (e.g. eu-west-1) | ||
* instances_keypair: name of your AWS private key file | ||
* image_id: AMI for the nFlow performance test servers | ||
* perftest_subnet: your VPC identifier | ||
* perftest_group_ids: security groups for nFlow performance test servers | ||
|
||
3. Create 2 nFlow servers, 1 client server, 1 Graphite server and 1 RDS database | ||
* execute "ansible-playbook provision_ec2.yml" | ||
* currently does not configure load balancer in front of nFlow servers, so configure this manually to port 7500 | ||
|
||
4. Deploy nFlow to AWS | ||
* execute "ansible-playbook -i /etc/ansible/ec2.py --private-key=nbank.pem deploy_nflow.yml" | ||
* installs required services (e.g. git and Maven) and builds nFlow from Github sources | ||
|
||
5. Optional: Install Graphite server by following [instructions](https://github.com/dmichel1/ansible-graphite) | ||
|
||
**Execute performance tests** | ||
|
||
1. Connect to your nFlow servers and start servers using the following command (change parameters to match your environment): | ||
``` | ||
java -Dhost=<your_nflow_server> -Dnflow.db.user=nflow -Dnflow.db.password=nflownflow | ||
-Dnflow.db.postgresql.url=jdbc:postgresql://<your_rds_database>:5432/nflow?tcpKeepAlive=true | ||
-Dnflow.executor.group=nflow-perf -Dnflow.non_spring_workflows_filename=workflows.txt | ||
-Dspring.profiles.active=nflow.db.postgresql -Dgraphite.host=<your_graphite_server> -Dgraphite.port=2003 | ||
-jar nflow/nflow-perf-test/target/nflow-perf-tests-*-SNAPSHOT.jar | ||
``` | ||
|
||
2. Connect to your nFlow client server and start performance client threads using the following command (change parameters to match your environment): | ||
``` | ||
java -Dnflow.url=http://<your_nflow_server_load_balancer>:7500 -cp nflow-perf-test/target/nflow-perf-tests-*-SNAPSHOT.jar com.nitorcreations.nflow.performance.client.LoadGenerator | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
nbank.pem |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
--- | ||
# ansible-playbook -i /etc/ansible/ec2.py --private-key=nbank.pem deploy_nflow.yml | ||
# | ||
# TODO: | ||
# - Start nFlow server automatically, something like: | ||
# java -Dnflow.db.user={{ db_user }} -Dnflow.db.password={{ db_password }} -Dnflow.db.postgresql.url={{ jdbc_url }} | ||
# -Dnflow.executor.group=nflow-perf -Dnflow.non_spring_workflows_filename=workflows.txt | ||
# -Dspring.profiles.active=nflow.db.postgresql -jar nflow/nflow-perf-test/target/nflow-perf-tests-*-SNAPSHOT.jar | ||
|
||
- name: Deploy and build nFlow to servers | ||
hosts: tag_Name_nflow-perftest-nflow-* | ||
remote_user: fedora | ||
gather_facts: false | ||
|
||
vars_files: | ||
- vars/perf-test-environment.yml | ||
|
||
tasks: | ||
- name: Install git | ||
yum: name=git state=present | ||
sudo: yes | ||
|
||
- name: Install Maven | ||
yum: name=maven state=present | ||
sudo: yes | ||
|
||
- name: Clone nflow repository | ||
git: repo=git://github.com/NitorCreations/nflow.git dest=~/nflow version=perf-test-once-more accept_hostkey=yes | ||
|
||
- name: Build nFlow | ||
shell: cd nflow && mvn package -DskipTests -P allModules | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
--- | ||
# ansible-playbook provision_ec2.yml | ||
# | ||
# Creates following servers/services to EC2 | ||
# - nFlow server(s) (server(s) being performance tested) | ||
# - nFlow client(s) (server(s) that run performance test clients) | ||
# - RDS service for nflow database (postgresql) | ||
# | ||
# Prerequisites | ||
# - Setup AWS access key and secret (e.g. env variable or .boto-file) | ||
# - Tune variables in vars/perf-test-environment.yml-file (TODO: automate some of these?) | ||
# + vpc_subnet_id-variables point to correct AWS VPC | ||
# + security groups are correct for your AWS VPC | ||
# + current directory contains pem-file that matches instances_keypair (e.g. nbank.pem) | ||
|
||
- name: Provision ec2 instances based on the environment | ||
hosts: localhost | ||
connection: local | ||
|
||
vars_files: | ||
- vars/perf-test-environment.yml | ||
|
||
tasks: | ||
|
||
- name: Launch tested nflow server instances | ||
ec2: | ||
region: "{{ ec2_region }}" | ||
keypair: "{{ item.keypair }}" | ||
group_id: "{{ item.group_id }}" | ||
vpc_subnet_id: "{{ item.vpc_subnet_id }}" | ||
instance_type: "{{ item.instance_type }}" | ||
image: "{{ item.image }}" | ||
instance_tags: "{{ item.instance_tags }}" | ||
exact_count: "{{ item.exact_count }}" | ||
count_tag: "{{ item.count_tag }}" | ||
assign_public_ip: "{{ item.assign_public_ip }}" | ||
wait: true | ||
register: nflow_perftest_nflow_servers | ||
with_items: nflow_server_instances | ||
tags: launch_nflow_server_instances | ||
|
||
- name: Launch tested nflow client instances | ||
ec2: | ||
region: "{{ ec2_region }}" | ||
keypair: "{{ item.keypair }}" | ||
group_id: "{{ item.group_id }}" | ||
vpc_subnet_id: "{{ item.vpc_subnet_id }}" | ||
instance_type: "{{ item.instance_type }}" | ||
image: "{{ item.image }}" | ||
instance_tags: "{{ item.instance_tags }}" | ||
exact_count: "{{ item.exact_count }}" | ||
count_tag: "{{ item.count_tag }}" | ||
assign_public_ip: "{{ item.assign_public_ip }}" | ||
wait: true | ||
register: nflow_perftest_nflow_clients | ||
with_items: nflow_client_instances | ||
tags: launch_nflow_client_instances | ||
|
||
- name: Launch RDS server | ||
rds: | ||
backup_retention: 0 | ||
command: create | ||
db_name: "{{ db_name }}" | ||
instance_name: nflow-perftest | ||
instance_type: db.m1.small | ||
db_engine: postgres | ||
port: 5432 | ||
multi_zone: no | ||
size: 5 | ||
username: "{{ db_user }}" | ||
password: "{{ db_password }}" | ||
region: "{{ ec2_region }}" | ||
security_groups: public-internet-postgresql | ||
tags: launch_rds_server | ||
|
||
- name: Launch Graphite server | ||
ec2: | ||
region: "{{ ec2_region }}" | ||
keypair: "{{ item.keypair }}" | ||
group_id: "{{ item.group_id }}" | ||
vpc_subnet_id: "{{ item.vpc_subnet_id }}" | ||
instance_type: "{{ item.instance_type }}" | ||
image: "{{ item.image }}" | ||
instance_tags: "{{ item.instance_tags }}" | ||
exact_count: "{{ item.exact_count }}" | ||
count_tag: "{{ item.count_tag }}" | ||
assign_public_ip: "{{ item.assign_public_ip }}" | ||
wait: true | ||
register: nflow_perftest_graphite_server | ||
with_items: nflow_graphite_instance | ||
tags: launch_nflow_graphite_instance | ||
|
Oops, something went wrong.