Mengonfigurasi pengumpul sampah untuk Pemroses Pesan

Di Edge for Private Cloud 4.54.00 (yang berjalan di Java 21), Pemroses Pesan menggunakan Garbage Collector Garbage-First (G1GC) secara default. Dokumen ini menjelaskan cara mengonfigurasi dan memverifikasi setelan pengumpulan sampah memori di Pemroses Pesan.

Menyesuaikan garbage collector di Pemroses Pesan

Bagian ini menguraikan prosedur untuk mengonfigurasi setelan Garbage Collection (GC) alternatif di Pemroses Pesan Edge. Anda mengelola parameter GC dengan memperbarui properti GC di Pemroses Pesan. Untuk menyesuaikan properti konfigurasi, gunakan sintaksis token yang ditentukan dalam Cara mengonfigurasi Edge.

Untuk mengubah setelan GC di Pemroses Pesan, lakukan langkah-langkah berikut:

  1. Memeriksa properti GC
  2. Mengubah GC di Pemroses Pesan

Memeriksa properti GC

Langkah-langkah berikut menjelaskan cara memeriksa properti GC yang dikonfigurasi:

  1. Cari properti GC di direktori sumber Pemroses Pesan /opt/apigee/edge-message-processor/source menggunakan perintah berikut:
    grep -riE "useG1GC|useZGC|useStringDeduplication" /opt/apigee/edge-message-processor/source
    
  2. Pastikan output perintah ini menampilkan konfigurasi properti GC untuk Pemroses Pesan:
    /opt/apigee/edge-message-processor/source/conf/system.properties:useG1GC={T}conf_system_useG1GC{/T}
    /opt/apigee/edge-message-processor/source/conf/system.properties:useZGC={T}conf_system_useZGC{/T}
    /opt/apigee/edge-message-processor/source/conf/system.properties:useStringDeduplication={T}conf_system_useStringDeduplication{/T}

    String di antara tag {T}{/T} adalah nama properti yang dapat Anda tetapkan dalam file .properties Pemroses Pesan.

Mengubah GC di Pemroses Pesan

Langkah-langkah berikut menjelaskan cara mengubah setelan GC di Pemroses Pesan Apigee:

  1. Buka /opt/apigee/customer/application/message-processor.properties file di mesin Pemroses Pesan di editor. Jika file belum ada, buat file tersebut. Contoh:
    vi /opt/apigee/customer/application/message-processor.properties
    
  2. Tambahkan baris konfigurasi GC yang diinginkan berdasarkan profil target Anda:
    • Opsi A: Menggunakan G1GC sebagai garbage collector default beserta beberapa modifikasi:
      conf_system_useG1GC=true
      conf_system_useStringDeduplication=true
      conf_system_g1gc.g1ReservePercent=15
    • Opsi B: Mengaktifkan ZGC Generasi (Opsional untuk deployment latensi sangat rendah deployment):
      conf_system_useG1GC=false
      conf_system_useZGC=true
      bin_setenv_max_meta_space_size=1024m
    • Opsi C: Mengaktifkan setelan GC generik:

      Tetapkan bin_setenv_ext_jvm_opts dalam file penggantian .properties komponen (/opt/apigee/customer/application/message-processor.properties) untuk mengonfigurasi properti GC generik, lalu mulai ulang komponen. Contoh:

      conf_system_useG1GC=false
      conf_system_useZGC=false
      bin_setenv_ext_jvm_opts="-XX:+UseParallelGC"
  3. Simpan perubahan.
  4. Pastikan file properti ini dimiliki oleh pengguna apigee. Contoh:
    chown apigee:apigee /opt/apigee/customer/application/message-processor.properties
    
  5. Mulai ulang Pemroses Pesan menggunakan perintah berikut:
    /opt/apigee/apigee-service/bin/apigee-service edge-message-processor restart
    
  6. Jika Anda memiliki lebih dari satu Pemroses Pesan, ulangi langkah-langkah ini di semua Pemroses Pesan.

Memperbarui penghapusan duplikat string

Secara default, konfigurasi G1GC menetapkan UseStringDeduplication ke true, yang mengoptimalkan alokasi memori heap Java dengan memungkinkan nilai String yang identik berbagi array karakter tunggal. Untuk menonaktifkan penghapusan duplikat string, tetapkan conf_system_useStringDeduplication=false di /opt/apigee/customer/application/message-processor.properties dan mulai ulang Pemroses Pesan, seperti yang dijelaskan dalam Mengubah GC di Pemroses Pesan.

Memverifikasi konfigurasi GC di Pemroses Pesan

Untuk memverifikasi bahwa perubahan konfigurasi GC Anda telah diterapkan di Pemroses Pesan:

  1. Cari properti GC di /opt/apigee/edge-message-processor/conf direktori dan pastikan properti tersebut telah ditetapkan dengan nilai baru. Contoh:
    grep -riE "useG1GC|useZGC|g1gc\.|useStringDeduplication" /opt/apigee/edge-message-processor/conf
    
  2. Pastikan /opt/apigee/edge-message-processor/conf/system.properties mencerminkan nilai yang baru Anda konfigurasi. Misalnya, setelan GC Default Apigee ditampilkan sebagai berikut:
    /opt/apigee/edge-message-processor/conf/system.properties:useG1GC=true
    /opt/apigee/edge-message-processor/conf/system.properties:useZGC=false
    /opt/apigee/edge-message-processor/conf/system.properties:g1gc.maxGCPauseMillis=200
    /opt/apigee/edge-message-processor/conf/system.properties:g1gc.initiatingHeapOccupancyPercent=45
    /opt/apigee/edge-message-processor/conf/system.properties:g1gc.g1ReservePercent=15
    /opt/apigee/edge-message-processor/conf/system.properties:useStringDeduplication=true
  3. Pastikan proses JVM Pemroses Pesan yang berjalan dimulai dengan flag -XX: yang diharapkan:
    ps -ef | grep edge-message-processor | grep -E "UseG1GC|UseZGC"
    
    • Untuk G1GC Default Apigee, pastikan command line menyertakan: -XX:+UseG1GC -XX:MaxGCPauseMillis=200 -XX:InitiatingHeapOccupancyPercent=45 -XX:G1ReservePercent=15 -XX:+UseStringDeduplication -XX:MaxMetaspaceSize=1024m
    • Untuk ZGC Generasi, pastikan command line menyertakan: -XX:+UseZGC -XX:+ZGenerational -XX:MaxMetaspaceSize=1024m
  4. Jika Anda masih tidak dapat mengonfigurasi setelan GC, hubungi Dukungan Apigee Edge.

Apa langkah selanjutnya?