-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathfine-tune-client.yaml
More file actions
34 lines (30 loc) · 1.11 KB
/
fine-tune-client.yaml
File metadata and controls
34 lines (30 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
---
- name: Fine-tune OS settings to let k6 run with large number of sockets
hosts: all
tasks:
- name: Increase number of maximum open files (also sockets)
ansible.builtin.blockinfile:
path: ~/.bashrc
block: |
# Increase soft limit for open files (sockets).
ulimit -n 100000
marker: "# {mark} ANSIBLE ULIMIT BLOCK"
create: yes
- name: Fine-tune IPv4 settings in Linux kernel
become: true
ansible.builtin.copy:
dest: /etc/sysctl.d/10-k6-fine-tune.conf
owner: root
group: root
mode: '0644'
content: |
# Fine tune some kernel settings as suggested by k6 docs.
# See: https://grafana.com/docs/k6/latest/set-up/fine-tune-os/
net.ipv4.ip_local_port_range=7000 65000
net.ipv4.tcp_tw_reuse=1
net.ipv4.tcp_timestamps=1
# Speed up socket closing by decreasing FIN_WAIT2 state timeout.
net.ipv4.tcp_fin_timeout=5
# Increase queue size for incoming packets (responses from the
# server).
net.core.netdev_max_backlog = 5000