|
| 1 | +# Installation & Administration Guide |
| 2 | + |
| 3 | +- [Installation](#installation) |
| 4 | +- [High performance configuration usage](#high-performance-configuration-usage) |
| 5 | + |
1 | 6 | ## Installation
|
2 | 7 |
|
3 | 8 | The Sigfox IoT Agent can be installed in two ways: cloning the GitHub repository, or using Docker.
|
@@ -26,3 +31,147 @@ Sigfox IoT Agent:
|
26 | 31 | ```bash
|
27 | 32 | docker run -t -i --link orion:orion -p 4041:4041 -p 17428:17428 fiware/sigfox-iotagent
|
28 | 33 | ```
|
| 34 | + |
| 35 | +## High performance configuration usage |
| 36 | + |
| 37 | +Node.js is single‑threaded and uses non-blocking I/O, allowing it to scale up to tens of thousands of concurrent |
| 38 | +operations. Nevertheless, Node.js has a few weak points and vulnerabilities that can make Node.js‑based systems to offer |
| 39 | +under-performance behaviour, specially when a Node.js web application experiences rapid traffic growth. |
| 40 | + |
| 41 | +Additionally, It is important to know the place in which the node.js server is running, because it has limitations. |
| 42 | +There are two types of limits on the host: hardware and software. Hardware limits can be easy to spot. Your application |
| 43 | +might be consuming all of the memory and needing to consume disk to continue working. Adding more memory by upgrading |
| 44 | +your host, whether physical or virtual, seems to be the right choice. |
| 45 | + |
| 46 | +Moreover, Node.js applications have also a software memory limit (imposed by V8), therefore we cannot forget about these |
| 47 | +limitations when we execute a service. In this case of 64-bit environment, your application would be running by default |
| 48 | +at a 1 GB V8 limit. If your application is running in high traffic scenarios, you will need a higher limit. The same is |
| 49 | +applied to other parameters. |
| 50 | + |
| 51 | +It means that we need to make some changes in the execution of node.js and in the configuration of the system: |
| 52 | + |
| 53 | +- **Node.js flags** |
| 54 | + |
| 55 | + - **--use-idle-notification** |
| 56 | + |
| 57 | + Turns of the use idle notification to reduce memory footprint. |
| 58 | + |
| 59 | + - **--expose-gc** |
| 60 | + |
| 61 | + Use the expose-gc command to enable manual control of the garbage collector from the own node.js server code. In |
| 62 | + case of the IoTAgent, it is not implemented because it is needed to implement the calls to the garbage collector |
| 63 | + inside the ser server, nevertheless the recommended value is every 30 seconds. |
| 64 | + |
| 65 | + - **--max-old-space-size=xxxx** |
| 66 | + |
| 67 | + In that case, we want to increase the limit for heap memory of each V8 node process in order to use max capacity |
| 68 | + that it is possible instead of the 1,4Gb default on 64-bit machines (512Mb on a 32-bit machine). The |
| 69 | + recommendation is at least to use half of the total memory of the physical or virtual instance. |
| 70 | + |
| 71 | +- **User software limits** |
| 72 | + |
| 73 | + Linux kernel provides some configuration about system related limits and maximums. In a distributed environment with |
| 74 | + multiple users, usually you need to take into control the resources that are available for each of the users. |
| 75 | + Nevertheless, when the case is that you have only one available user but this one request a lot of resources due to |
| 76 | + a high performance application the default limits are not proper configured and need to be changed to resolve the |
| 77 | + high performance requirements. These are like maximum file handler count, maximum file locks, maximum process count |
| 78 | + etc. |
| 79 | + |
| 80 | + You can see the limits of your system executing the command: |
| 81 | + |
| 82 | + ```bash |
| 83 | + ulimit -a |
| 84 | + ``` |
| 85 | + |
| 86 | + You can define the corresponding limits inside the file limits.conf. This description of the configuration file |
| 87 | + syntax applies to the `/etc/security/limits.conf` file and \*.conf files in the `/etc/security/limits.d` directory. |
| 88 | + You can get more information about the limits.conf in the |
| 89 | + [limits.con - linux man pages](http://man7.org/linux/man-pages/man5/limits.conf.5.html). The recommended values to |
| 90 | + be changes are the following: |
| 91 | + |
| 92 | + - **core** |
| 93 | + |
| 94 | + Limits of the core file size in KB, we recommend to change to `unlimited` both hard and soft types. |
| 95 | + |
| 96 | + * soft core unlimited |
| 97 | + * hard core unlimited |
| 98 | + |
| 99 | + - **data** |
| 100 | + |
| 101 | + Maximum data size in KB, we recommend to change to `unlimited` both hard and soft types. |
| 102 | + |
| 103 | + * soft data unlimited |
| 104 | + * hard data unlimited |
| 105 | + |
| 106 | + - **fsize** |
| 107 | + |
| 108 | + Maximum filesize in KB, we recommend to change to `unlimited` both hard and soft types. |
| 109 | + |
| 110 | + * soft fsize unlimited |
| 111 | + * hard fsize unlimited |
| 112 | + |
| 113 | + - **memlock** |
| 114 | + |
| 115 | + Maximum locked-in-memory address space in KB, we recommend to change to `unlimited` both hard and soft types. |
| 116 | + |
| 117 | + * memlock unlimited |
| 118 | + * memlock unlimited |
| 119 | + |
| 120 | + - **nofile** |
| 121 | + |
| 122 | + Maximum number of open file descriptors, we recommend to change to `65535` both hard and soft types. |
| 123 | + |
| 124 | + * soft nofile 65535 |
| 125 | + * hard nofile 65535 |
| 126 | + |
| 127 | + - **rss** |
| 128 | + |
| 129 | + Maximum resident set size in KB (ignored in Linux 2.4.30 and higher), we recommend to change to `unlimited` both |
| 130 | + hard and soft types. |
| 131 | + |
| 132 | + * soft rss unlimited |
| 133 | + * hard rss unlimited |
| 134 | + |
| 135 | + - **stack** |
| 136 | + |
| 137 | + Maximum stack size in KB, we recommend to change to `unlimited` both hard and soft types. |
| 138 | + |
| 139 | + * soft stack unlimited |
| 140 | + * hard stack unlimited |
| 141 | + |
| 142 | + - **nproc** |
| 143 | + |
| 144 | + Maximum number of processes, we recommend to change to `unlimited` both hard and soft types. |
| 145 | + |
| 146 | + * soft nproc unlimited |
| 147 | + * hard nproc unlimited |
| 148 | + |
| 149 | + You can take a look to the [limits.conf](limits.conf) file provided in this folder with all the values provided. |
| 150 | + |
| 151 | +- **Configure kernel parameters** |
| 152 | + |
| 153 | + sysctl is used to modify kernel parameters at runtime. We plan to modify the corresponding `/etc/sysctl.conf` file. |
| 154 | + You can get more information in the corresponding man pages of |
| 155 | + [sysctl](http://man7.org/linux/man-pages/man8/sysctl.8.html) and |
| 156 | + [sysctl.conf](http://man7.org/linux/man-pages/man5/sysctl.conf.5.html). You can search all the kernel parameters by |
| 157 | + using the command `sysctl -a` |
| 158 | + |
| 159 | + - **fs.file-max** |
| 160 | + |
| 161 | + The maximum file handles that can be allocated, the recommended value is `1000000`. |
| 162 | + |
| 163 | + fs.file-max = 1000000 |
| 164 | + |
| 165 | + - **fs.nr_open** |
| 166 | + |
| 167 | + Max amount of file handles that can be opened, the recommended value is `1000000`. |
| 168 | + |
| 169 | + fs.nr_open = 1000000 |
| 170 | + |
| 171 | + - **net.netfilter.nf_conntrack_max** |
| 172 | + |
| 173 | + Size of connection tracking table. Default value is nf_conntrack_buckets value \* 4. |
| 174 | + |
| 175 | + net.nf_conntrack_max = 1048576 |
| 176 | + |
| 177 | + For more details about any other kernel parameters, take a look to the example [sysctl.conf](sysctl.conf) file. |
0 commit comments