blob: 626be6c7deb764677542c854d05f85573849fad7 [file] [log] [blame]
Nathan Skrzypczak9ad39c02021-08-19 11:38:06 +02001.. _running:
2
3Running VPP
4===========
5
6.. toctree::
7
8Usergroup
9---------
10
11When VPP is installed, a new usergroup *'vpp'* is created. To avoid running the
12VPP CLI (vppctl) as root, add any existing users to the new group that need to
13interact with VPP:
14
15.. code-block:: console
16
17 $ sudo usermod -a -G vpp user1
18
19Update your current session for the group change to take effect:
20
21.. code-block:: console
22
23 $ newgrp vpp
24
25
26Systemd File vpp.service
27------------------------
28
29When the VPP is installed, a systemd service files is also installed. This
30file, vpp.service (Ubuntu: /lib/systemd/system/vpp.service and CentOS:
31/usr/lib/systemd/system/vpp.service), controls how VPP is run as a service. For
32example, whether or not to restart on failure and if so, with how much delay.
33Also, which UIO driver should be loaded and location of the *'startup.conf'*
34file.
35
36.. code-block:: console
37
38 $ cat /usr/lib/systemd/system/vpp.service
39 [Unit]
40 Description=Vector Packet Processing Process
41 After=syslog.target network.target auditd.service
42
43 [Service]
44 ExecStartPre=-/bin/rm -f /dev/shm/db /dev/shm/global_vm /dev/shm/vpe-api
45 ExecStartPre=-/sbin/modprobe uio_pci_generic
46 ExecStart=/usr/bin/vpp -c /etc/vpp/startup.conf
47 Type=simple
48 Restart=on-failure
49 RestartSec=5s
50
51 [Install]
52 WantedBy=multi-user.target
53
54.. note::
55
56 Some older versions of the *'uio_pci_generic'* driver don't bind all
57 the supported NICs properly, so the *'igb_uio'* driver built from DPDK
58 needs to be installed. This file controls which driver is loaded at boot.
59 *'startup.conf'* file controls which driver is used.
60
61Huge Pages
62----------
63
64VPP requires *hugepages* to run during VPP operation, to manage large pages of memory.
65During VPP installation, VPP will overwrite the existing hugepage settings.
66By default, VPP sets the number of hugepages on a system to 1024 2M hugepages.
67This is the number of hugepages on the system, not just used by VPP.
68
69When VPP is installed, the following configuration file is copied to the system. The
70hugepage settings are applied in the VPP installation and on system reboots. To set
71the hugepage settings, perform the following commands:
72
73.. code-block:: console
74
75 $ cat /etc/sysctl.d/80-vpp.conf
76 # Number of 2MB hugepages desired
77 vm.nr_hugepages=1024
78
79 # Must be greater than or equal to (2 * vm.nr_hugepages).
80 vm.max_map_count=3096
81
82 # All groups allowed to access hugepages
83 vm.hugetlb_shm_group=0
84
85 # Shared Memory Max must be greater or equal to the total size of hugepages.
86 # For 2MB pages, TotalHugepageSize = vm.nr_hugepages * 2 * 1024 * 1024
87 # If the existing kernel.shmmax setting (cat /sys/proc/kernel/shmmax)
88 # is greater than the calculated TotalHugepageSize then set this parameter
89 # to current shmmax value.
90 kernel.shmmax=2147483648
91
92Depending on how the system is being used, this configuration file can be updated to adjust
93the number of hugepages reserved on a system. Below are some examples of
94possible settings.
95
96For a small VM with minimal workload:
97
98.. code-block:: console
99
100 vm.nr_hugepages=512
101 vm.max_map_count=2048
102 kernel.shmmax=1073741824
103
104For a large system running multiple VMs, each needing its own set of hugepages:
105
106.. code-block:: console
107
108 vm.nr_hugepages=32768
109 vm.max_map_count=66560
110 kernel.shmmax=68719476736
111
112
113.. note::
114
115 If VPP is being run in a Virtual Machine (VM), the VM must have hugepage
116 backing. When VPP is installed, it will attempt to overwrite existing the
117 hugepage setting. If the VM does not have hugepage backing, the install will fail,
118 but the failure may go unnoticed. When the VM is rebooted, on system startup,
119 *'vm.nr_hugepages'* will be reapplied, and will fail, and the VM will abort kernel
120 boot, locking up the VM. To avoid this scenario, ensure the VM has enough
121 hugepage backing.