Skip to main content

How to improve Passwd speed

note

Tier: Enterprise

Have you noticed a decrease in Passwd’s performance?

The app runs on your Google Cloud setup, optimized to handle hundreds of secrets effectively. However, as your user base and the number of secrets grow, it might slow down. If retrieving secrets takes longer than three seconds, it’s advised to boost the app’s hardware resources. This upgrade might come with a slight increase in cost, usually a few cents a month.

Step by step guide

To get this upgrade done, simply follow these steps:

  1. Access the Passwd Google Cloud Platform (GCP) project
  2. Navigate to Cloud Build -> Triggers through the following link: (https://console.cloud.google.com/cloud-build/triggers)
  3. Click and select Edit
  4. Scroll down to “Advanced section” and search for the _MEMORY_LIMIT variable
    1. If the variable exists, simply increase the value. 
    2. If the variable does not exist, create it. The default value is 512Mi
      1. Possible values from lowest to highest are 512Mi, 1Gi, 2Gi, 4Gi, 8Gi, 16Gi and 32Gi. 
  5. Initiate the trigger run by selecting ‘run’
  6. After around 15 minutes, you can review the History section in Cloud Build to ensure everything went smoothly
  7. 🎉 Passwd should run significantly faster now

Step 1-3

Step 4-5

Step 6

Slow Initial Load (Cold Starts)

If you or your users experience a delay of several seconds when opening the app for the first time or after a period of inactivity, you are likely encountering a Cold Start.

By default, Cloud Run scales your application down to zero instances when there is no active traffic. This ensures you only pay for what you use. However, when a new request arrives after a period of silence, Cloud Run must "spin up" a brand new container, load the application code, and start the server. This initialization process creates the "first-hit" lag known as a Cold Start.

Solution: Minimum Instances

To eliminate this delay, you can configure Min Instances. This setting instructs Google Cloud to keep a specific number of containers "warm" and ready to serve traffic immediately, even during idle periods.

ProsCons
Instant response times; eliminates "first-hit" lag; improved user experience.You are billed for these idle instances (typically at a discounted "idle" rate).

Step by step guide

To adjust this setting for your Passwd deployment, follow these steps within your Google Cloud Console:

  1. Navigate to Cloud Build > Triggers.
  2. Click on the passwd-pipeline trigger to edit its configuration.
  3. Scroll down to the Substitutions section near the bottom of the page.
  4. Click Add Variable and enter the following details:
    • Variable: _CLOUDRUN_MIN_INSTANCES (Note: The leading underscore is required).
    • Value: Enter your desired number of instances (e.g., 1 to keep one instance warm, or 0 to disable and return to default behavior).
  5. Click Save.

Note: The changes will take effect during the next deployment triggered by the pipeline. If you need the changes to apply immediately, you can manually run the trigger after saving.