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

אפשר להגדיר את הגודל של מאגר החיבורים ואת הקיבולת שלו כשמתחברים ל-Cloud SQL ל-PostgreSQL באמצעות מודול Node.js knex.

המשך למידה

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

דוגמת קוד

Node.js

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

// 'max' 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.pool.max = 5;
// 'min' is the minimum number of idle connections Knex maintains in the pool.
// Additional connections will be established to meet this value unless the pool is full.
config.pool.min = 5;

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

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