Skip to main content

Optimization of Kuroco Usage Fees

When Kuroco usage fees become high, it is important to take steps to optimize costs effectively. By following the steps outlined below, you can optimize your usage fees.

Check Your Usage Fees​

First, check your current usage status and cost breakdown.

Checking Procedure​

  1. Click on [Environment] -> [Usage].
  2. Check the cost breakdown under "Cost of all managed sites"
  3. Review the cost trends in the "Cost chart"
    (The cost chart is not displayed for customers with afixed-rate contracts.)
  4. Check detailed usage in "Daily usage"

Key Cost Items​

In the daily usage, you can see the usage fees for each of the following items. For each item, examples of cost reduction are provided, so adjust accordingly.

tip

You can check each log in [Operation] -> [Log Management] and perform more detailed analysis.

Optimizing Kuroco Usage Fees​

Increase Cache Ratio​

Increasing the cache ratio is crucial for reducing Kuroco usage fees since cached API requests are usually cheaper than regular API requests.

By changing from session-based cookies, which create a cache for each session, to static access tokens, which create a cache for each token, you can improve the cache ratio. Consider using static access tokens for endpoints that do not require authentication.

caution

Adjustments on the frontend side will also be necessary.

Cache Settings for API Endpoints​

If cache settings are not configured for endpoints, please set them up. Kuroco recommends settings like 1 day or 1 week, and since there is a mechanism to automatically clear the cache when content is updated, setting it for a longer period should not be a problem.

Create Endpoints that Do Not Clear Cache​

To keep data up to date, Kuroco automatically clears the cache when content is updated.

By using endpoints like Api::request_api that do not clear the cache instead of Topics::list, you may be able to improve the cache ratio.

caution

Be aware that you need to set the timing and scope of cache clearing yourself.


Reduce API Requests​

Utilizing SSG (Static Site Generation)​

By changing the site rendering method to SSG, data retrieval using APIs only occurs during deployment, which often leads to a reduction in the number of API requests.

caution

Sending requests from the client-side pages does not reduce the number of API requests.
Also, depending on the number of daily deployments and page views, the API request count may not decrease.
It is important to calculate in advance.

Optimization of Internal API Calls​

The {api_internal} Smarty plugin results in network requests, which count towards the API request count. By setting direct=true or replacing it with the {api_method} Smarty plugin, it is possible to reduce the number of API requests.

Optimization of API Calls​

When making requests for data retrieval on a per-page basis, the number of requests increases as the number of frontend pages increases. Designing to retrieve data in advance and then generate pages can help reduce the API request count.

For example, one use case might be retrieving data using Topics::list instead of making multiple requests to Topics::details to reduce the number of API calls.

However, retrieving a large amount of data at once to reduce API request counts can result in slower response times and increased computing costs.
It is recommended to limit the number of items per API response to approximately 20–200 items.
Also, narrowing down the necessary fields during post-processing may improve processing speed. In such cases, fetching around 1,000 items at once can be a viable option.

Removal of Unnecessary APIs​

  • Please check for any unnecessary API calls from the frontend.

Domain Optimization for File Access​

When accessing files through the API domain, they are counted as API requests. Consider replacing it with the Files domain if necessary.


Reduce API Transfer Volume​

Setting Allow list in Post-processing​

To reduce API transfer volume, it is necessary to reduce the response size of endpoints. Setting allow lists in post-processing of endpoints to only include necessary items can reduce response capacity and have an effect on reducing API transfer volume.


Reduce KurocoFront Transfer Volume​

Optimization of 404 Pages​

Bots and crawlers may access non-existent URLs by guessing URLs, which can lead to KurocoFront displaying a 404 page and incurring CDN transfer volume.

For each access to a non-existent page, the CDN transfer volume increases by the size of the 404 page. Therefore, designing error pages such as 404 to be as lightweight as possible can reduce CDN transfer volume.


Reduce KurocoFiles Transfer Volume​

Record Images in CDN with Appropriate Image Sizes through Dynamic Image Conversion​

By utilizing dynamic conversion, you can dynamically change aspects such as image size and quality and store the modified content in the CDN cache. Requesting and loading images that have undergone appropriate conversion can prevent unnecessary loading of large images from the CDN, thus reducing CDN transfer volume.


Reduce DB File Size​

Deletion of Update History​

Enabling the option to not keep update history in the detailed settings of content structure editor will delete past update histories, and no update histories will be retained in subsequent updates. Enabling this option can effectively reduce the DB file size if update history is unnecessary.

caution

Deleted update histories cannot be restored.


Reducing File Size​

Optimizing File Size​

Even if you are dynamically adjusting the size and quality of images using dynamic conversion features, the usage fee for file size will be charged based on the size of the original file.
If the size of the original image is larger than necessary, reducing the file size is possible by placing the adjusted image in KurocoFiles.


Reducing KurocoFront File Size​

Setting to Delete Files Older Than 90 Days​

KurocoFront stores files for each commit hash, so enabling the setting to automatically delete old files is recommended.

  1. [Kuroco Front] → [KurocoFront Settings]
  2. Enable "Delete files older than 90 days"

Moving Images and Files to KurocoFiles​

Even with the setting to delete history older than 90 days, files stored in KurocoFront will not be deleted for 90 days.
Therefore, static files like images accumulate in KurocoFront with each deployment, resulting in additional storage costs.

Using KurocoFiles for static images and files can help reduce the storage space used by KurocoFront.


Reducing Backup File Size​

Deleting Unnecessary Backups​

If there are any unnecessary backup files in [Settings] -> [Backup], please delete them.
Creating batch processes using the Smarty plugins {backup} and {backup_delete} to automatically add or remove backups can also be effective.


Support

If you have any other questions, please contact us or check out Our Slack Community.