הגדרת מגבלות על מאגר החיבורים ועל גלישה מעבר למאגר כשמשתמשים ב-HikariCP

הגדרה של גודל מאגר החיבורים והגלישה כשמתחברים ל-Cloud SQL ל-PostgreSQL באמצעות ספריית מאגר החיבורים של HikariCP JDBC.

המשך למידה

לקבלת הסבר מפורט שכולל את דוגמת הקוד הזו, קראו את המאמר:

דוגמת קוד

Java

כדי לבצע אימות ב-Cloud SQL ל-PostgreSQL, אתם צריכים להגדיר את Application Default Credentials. מידע נוסף זמין במאמר הגדרת אימות לסביבת פיתוח מקומית.

// maximumPoolSize limits the total number of concurrent connections this pool will keep. Ideal
// values for this setting are highly variable on app design, infrastructure, and database.
config.setMaximumPoolSize(5);
// minimumIdle is the minimum number of idle connections Hikari maintains in the pool.
// Additional connections will be established to meet this value unless the pool is full.
config.setMinimumIdle(5);

המאמרים הבאים

כדי לחפש ולסנן דוגמאות קוד למוצרים אחרים של Google Cloud , אפשר להיעזר בדפדפן לדוגמאות שלGoogle Cloud .