

Terjemahan disediakan oleh mesin penerjemah. Jika konten terjemahan yang diberikan bertentangan dengan versi bahasa Inggris aslinya, utamakan versi bahasa Inggris.

# Menyetel instans EC2 Anda untuk kinerja
<a name="ec2-instance-performance-tuning"></a>

**catatan**  
Jika Anda menyediakan sumber daya AWS menggunakan CloudFormation templat, penyetelan ini akan diterapkan secara otomatis. Jika Anda menggunakan AMI atau membuat instans EC2 secara manual, maka penyetelan kinerja ini harus diterapkan untuk mencapai kinerja yang paling andal.

Ingatlah untuk me-reboot instance Anda setelah menerapkan penyetelan apa pun.

**Topik**
+ [Menyetel interupsi perangkat keras dan menerima antrian - berdampak pada CPU dan jaringan](#tune-hardware-interrupts)
+ [Penyatuan interupsi Tune Rx - berdampak pada jaringan](#tune-rx-interrupts)
+ [Buffer cincin Tune Rx - berdampak pada jaringan](#tune-rx-ring-buffer)
+ [Tune CPU C-State - berdampak pada CPU](#tune-cpu-c-state)
+ [Reserve port ingress - berdampak pada jaringan](#reserve-ingress-ports)
+ [Boot ulang](#reboot)

## Menyetel interupsi perangkat keras dan menerima antrian - berdampak pada CPU dan jaringan
<a name="tune-hardware-interrupts"></a>

Bagian ini mengkonfigurasi penggunaan inti CPU systemd, SMP IRQs, Receive Packet Steering (RPS) dan Receive Flow Steering (RFS). Lihat [Lampiran: Parameter yang disarankan untuk lagu interrupt/RPS](#recommended-parameters) sekumpulan pengaturan yang direkomendasikan berdasarkan jenis instans yang Anda gunakan.

1. Pin systemd memproses jauh dari inti CPU agen.

1. Permintaan interupsi perangkat keras rute jauh dari inti CPU agen.

1. Konfigurasikan RPS untuk mencegah antrian perangkat keras dari kartu antarmuka jaringan tunggal menjadi hambatan dalam lalu lintas jaringan.

1. Konfigurasikan RFS untuk meningkatkan hit rate cache CPU dan dengan demikian mengurangi latensi jaringan.

`set_irq_affinity.sh`Skrip yang disediakan oleh RPM mengkonfigurasi semua hal di atas untuk Anda. Tambahkan ke crontab, sehingga diterapkan pada setiap boot:

```
echo "@reboot sudo /opt/aws/groundstation/bin/set_irq_affinity.sh '${interrupt_core_list}' '${rps_core_mask}' >> /var/log/user-data.log 2>&1" >>/var/spool/cron/root
```
+ Ganti `interrupt_core_list` dengan core yang dicadangkan untuk kernel dan OS - biasanya yang pertama dan kedua bersama dengan pasangan inti hyper-threaded. Ini seharusnya tidak tumpang tindih dengan inti yang dipilih di atas. (Contoh: '0,1,48,49' untuk instance 96-CPU hyper-threaded).
+ `rps_core_mask`adalah bit mask heksadesimal yang menentukan mana yang CPUs harus memproses paket masuk, dengan setiap digit mewakili 4. CPUs Itu juga harus dipisahkan koma setiap 8 karakter mulai dari kanan. Disarankan untuk mengizinkan semua CPUs dan membiarkan caching menangani penyeimbangan.
  + Untuk melihat daftar parameter yang direkomendasikan untuk setiap jenis instance, lihat[Lampiran: Parameter yang disarankan untuk lagu interrupt/RPS](#recommended-parameters).
+  Contoh untuk instance 96-CPU: 

  ```
  echo "@reboot sudo /opt/aws/groundstation/bin/set_irq_affinity.sh '0,1,48,49' 'ffffffff,ffffffff,ffffffff' >> /var/log/user-data.log 2>&1" >>/var/spool/cron/root
  ```

## Penyatuan interupsi Tune Rx - berdampak pada jaringan
<a name="tune-rx-interrupts"></a>

 Penggabungan interupsi membantu mencegah banjir sistem host dengan terlalu banyak interupsi dan membantu meningkatkan throughput jaringan. Dengan konfigurasi ini, paket dikumpulkan dan satu interupsi tunggal dihasilkan setiap 128 mikrodetik. Tambahkan ke crontab, sehingga diterapkan pada setiap boot: 

```
echo "@reboot sudo ethtool -C ${interface} rx-usecs 128 tx-usecs 128 >>/var/log/user-data.log 2>&1" >>/var/spool/cron/root
```
+ Ganti `interface` dengan antarmuka jaringan (adaptor ethernet) yang dikonfigurasi untuk menerima data. Biasanya, ini `eth0` karena itulah antarmuka jaringan default yang ditetapkan untuk instans EC2.

## Buffer cincin Tune Rx - berdampak pada jaringan
<a name="tune-rx-ring-buffer"></a>

 Tingkatkan jumlah entri dering untuk buffer cincin Rx untuk mencegah penurunan paket atau overrun selama koneksi pecah. Tambahkan ke crontab, sehingga diatur dengan benar pada setiap boot: 

```
echo "@reboot sudo ethtool -G ${interface} rx 16384 >>/var/log/user-data.log 2>&1" >>/var/spool/cron/root
```
+ Ganti `interface` dengan antarmuka jaringan (adaptor ethernet) yang dikonfigurasi untuk menerima data. Biasanya, ini `eth0` karena itulah antarmuka jaringan default yang ditetapkan untuk instans EC2.
+ Jika menyiapkan instance `c6i` keluarga, perintah perlu dimodifikasi untuk mengatur buffer ring ke`8192`, bukan. `16384`

## Tune CPU C-State - berdampak pada CPU
<a name="tune-cpu-c-state"></a>

 Atur CPU C-state untuk mencegah idle yang dapat menyebabkan paket hilang selama dimulainya kontak. Membutuhkan contoh reboot. 

```
echo "GRUB_CMDLINE_LINUX_DEFAULT=\"console=tty0 console=ttyS0,115200n8 net.ifnames=0 biosdevname=0 nvme_core.io_timeout=4294967295 intel_idle.max_cstate=1 processor.max_cstate=1 max_cstate=1\"" >/etc/default/grub
echo "GRUB_TIMEOUT=0" >>/etc/default/grub
grub2-mkconfig -o /boot/grub2/grub.cfg
```

## Reserve port ingress - berdampak pada jaringan
<a name="reserve-ingress-ports"></a>

 Cadangan semua port dalam rentang port alamat ingress Anda `AwsGroundStationAgentEndpoint` untuk mencegah konflik dengan penggunaan kernel. Konflik penggunaan port akan menyebabkan kegagalan kontak dan pengiriman data. 

```
echo "net.ipv4.ip_local_reserved_ports=${port_range_min}-${port_range_max}" >> /etc/sysctl.conf
```
+ Contoh:`echo "net.ipv4.ip_local_reserved_ports=42000-43500" >> /etc/sysctl.conf`.

## Boot ulang
<a name="reboot"></a>

Setelah semua penyetelan berhasil diterapkan, reboot instance agar penyetelan diterapkan.

```
sudo reboot
```

## Lampiran: Parameter yang disarankan untuk lagu interrupt/RPS
<a name="recommended-parameters"></a>

 Bagian ini menentukan nilai parameter yang disarankan untuk digunakan di bagian tuning Tune Hardware Interrupts and Receive Queues - Dampak CPU dan Jaringan. 


| Rangkaian | Tipe Instans | \$1 \$1interrupt\$1core\$1list\$1 | \$1 \$1rps\$1core\$1mask\$1 | 
| --- | --- | --- | --- | 
|  c7i  |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/id_id/ground-station/latest/gs-agent-ug/ec2-instance-performance-tuning.html)  |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/id_id/ground-station/latest/gs-agent-ug/ec2-instance-performance-tuning.html)  |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/id_id/ground-station/latest/gs-agent-ug/ec2-instance-performance-tuning.html)  | 
|  c6i  |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/id_id/ground-station/latest/gs-agent-ug/ec2-instance-performance-tuning.html)  |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/id_id/ground-station/latest/gs-agent-ug/ec2-instance-performance-tuning.html)  |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/id_id/ground-station/latest/gs-agent-ug/ec2-instance-performance-tuning.html)  | 
|  c5  |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/id_id/ground-station/latest/gs-agent-ug/ec2-instance-performance-tuning.html)  |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/id_id/ground-station/latest/gs-agent-ug/ec2-instance-performance-tuning.html)  |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/id_id/ground-station/latest/gs-agent-ug/ec2-instance-performance-tuning.html)  | 
|  c5n  |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/id_id/ground-station/latest/gs-agent-ug/ec2-instance-performance-tuning.html)  |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/id_id/ground-station/latest/gs-agent-ug/ec2-instance-performance-tuning.html)  |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/id_id/ground-station/latest/gs-agent-ug/ec2-instance-performance-tuning.html)  | 
|  m5  |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/id_id/ground-station/latest/gs-agent-ug/ec2-instance-performance-tuning.html)  |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/id_id/ground-station/latest/gs-agent-ug/ec2-instance-performance-tuning.html)  |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/id_id/ground-station/latest/gs-agent-ug/ec2-instance-performance-tuning.html)  | 
|  r5  |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/id_id/ground-station/latest/gs-agent-ug/ec2-instance-performance-tuning.html)  |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/id_id/ground-station/latest/gs-agent-ug/ec2-instance-performance-tuning.html)  |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/id_id/ground-station/latest/gs-agent-ug/ec2-instance-performance-tuning.html)  | 
|  r5n  |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/id_id/ground-station/latest/gs-agent-ug/ec2-instance-performance-tuning.html)  |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/id_id/ground-station/latest/gs-agent-ug/ec2-instance-performance-tuning.html)  |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/id_id/ground-station/latest/gs-agent-ug/ec2-instance-performance-tuning.html)  | 
|  g4dn  |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/id_id/ground-station/latest/gs-agent-ug/ec2-instance-performance-tuning.html)  |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/id_id/ground-station/latest/gs-agent-ug/ec2-instance-performance-tuning.html)  |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/id_id/ground-station/latest/gs-agent-ug/ec2-instance-performance-tuning.html)  | 
|  p4d  |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/id_id/ground-station/latest/gs-agent-ug/ec2-instance-performance-tuning.html)  |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/id_id/ground-station/latest/gs-agent-ug/ec2-instance-performance-tuning.html)  |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/id_id/ground-station/latest/gs-agent-ug/ec2-instance-performance-tuning.html)  | 
|  p3dn  |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/id_id/ground-station/latest/gs-agent-ug/ec2-instance-performance-tuning.html)  |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/id_id/ground-station/latest/gs-agent-ug/ec2-instance-performance-tuning.html)  |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/id_id/ground-station/latest/gs-agent-ug/ec2-instance-performance-tuning.html)  | 