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:
Memeriksa properti GC
Langkah-langkah berikut menjelaskan cara memeriksa properti GC yang dikonfigurasi:
-
Cari properti GC di direktori sumber Pemroses Pesan
/opt/apigee/edge-message-processor/sourcemenggunakan perintah berikut:grep -riE "useG1GC|useZGC|useStringDeduplication" /opt/apigee/edge-message-processor/source
-
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.propertiesPemroses Pesan.
Mengubah GC di Pemroses Pesan
Langkah-langkah berikut menjelaskan cara mengubah setelan GC di Pemroses Pesan Apigee:
-
Buka
/opt/apigee/customer/application/message-processor.propertiesfile di mesin Pemroses Pesan di editor. Jika file belum ada, buat file tersebut. Contoh:vi /opt/apigee/customer/application/message-processor.properties
-
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_optsdalam file penggantian.propertieskomponen (/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"
-
Opsi A: Menggunakan G1GC sebagai garbage collector default beserta beberapa
modifikasi:
- Simpan perubahan.
-
Pastikan file properti ini dimiliki oleh pengguna
apigee. Contoh:chown apigee:apigee /opt/apigee/customer/application/message-processor.properties
-
Mulai ulang Pemroses Pesan menggunakan perintah berikut:
/opt/apigee/apigee-service/bin/apigee-service edge-message-processor restart
- 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:
-
Cari properti GC di
/opt/apigee/edge-message-processor/confdirektori dan pastikan properti tersebut telah ditetapkan dengan nilai baru. Contoh:grep -riE "useG1GC|useZGC|g1gc\.|useStringDeduplication" /opt/apigee/edge-message-processor/conf
-
Pastikan
/opt/apigee/edge-message-processor/conf/system.propertiesmencerminkan 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
-
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
-
Untuk G1GC Default Apigee, pastikan command line
menyertakan:
- Jika Anda masih tidak dapat mengonfigurasi setelan GC, hubungi Dukungan Apigee Edge.