Alokai Fair Use Guidelines

Our license includes usage that is subject to these fair use guidelines. The exact terms and limits can be found in the order forms. Below, you can find recommendations and general guidelines that you should follow to ensure that you stay within the “fair use” limits of resource consumption.

Following these rules will not only keep your costs under control but also improve the reliability and speed of your application. Based on our experience, applications that do not follow these rules often struggle with long response times and can have issues with handling traffic peaks (eg. getting a higher response error rate or increasing the response time).

How do we estimate “fair use”?

We calculate our fair use limits based on the average resource consumption of all Alokai applications within our customer base. An application within fair use limits consumes resources adequately for its traffic

How to stay within the fair use limits:

A good rule of thumb for determining what is and isn’t fair use is assessing if your application has any significant performance bottlenecks or non-standard inefficiencies. These things usually lead to significantly exceeded resource consumption and decreased application reliability. Applications that follow basic best practices of developing JavaScript applications should never exceed the fair use limits. 

General recommendations Based on our experience the following factors has the biggest impact on overall reliability and resource consumption of your Alokai application:

  • Very High Impact: Follow the advice of our team and best practices from the documentation. Our team is constantly monitoring all instances of our customers to make sure that your application remains reliable even under heavy load. When we discover anomalies we notify  you about them and proactively suggest improvements to your Alokai Application.

  • Very High impact: Avoid memory leaks Memory leaks are the single biggest contributor to increased resource consumption and can very often even cause a downtime of the whole application. We recommend  to periodically profile your application to make sure that there are no memory leaks. Based on our experience, it’s impossible to stay within fair use limits if your application has memory leaks. Here you can find a guide on how to identify memory leaks in Next.js or any other Node.js-based Application (like Nuxt) . Tools like Fuite can also be helpful in identifying the source of your memory leak.

  • Very High Impact: Cache frontend URLs with possible long TTL and serve through the CDN Server-side work is the most resource-heavy process in your application. You can easily avoid a lot of it by simply caching what was already rendered on the server and sending it directly to the user instead of waiting for it to be generated again. This way you will not only save on bandwidth but also improve speed and reliability of your application. Keep in mind that your HTML needs to be personalization-free to be cacheable (read more here )

  • High impact: Cache Middleware GET requests To significantly reduce the resource consumption and increase the efficiency of the Middleware application, we strongly recommend caching your non-personalized GET requests. Here , you can read how to do this.

  • High Impact: Limit transfer out value. Avoid using 3rd party services for caching or additional data processing. Sending high volumes of data out might generate additional costs and increase the latency. Using an internal network for data processing should always be prioritized as a best practice. If you need additional data processing or internal caching, reach our Customer Success team so they offer perspective on things to consider on solutions. .

  • High impact: Keep your Lighthouse score high While the Lighthouse score does not have a huge impact on the overall resource consumption, low score is an indicator that the application is not well-optimized. Metrics such as TTFB and TBT could indicate that the amount of JavaScript code being processed is too big, which will lead to performance bottlenecks and inefficient resource consumption.

  • High impact: Keep your JavaScript bundle small. JavaScript has the biggest impact on memory and CPU consumption. Keep your JavaScript bundle small (ideally below 250kB gzipped) by avoiding expensive third-party libraries, using server components, moving business logic to the middleware, and lazy loading non-critical elements.

  • High Impact: Apply all security patches. Security vulnerabilities can open possibilities for attackers to exploit your application and use resources inefficiently. Applying security patches is essential for preserving the business by protecting against vulnerabilities, ensuring compliance with regulations, and maintaining customer trust. 

How to monitor your fair use limits?

You can monitor your resource consumption and how close it is to reaching the limits in the Alokai Console.

If you’re not live yet with your Alokai application, we recommend doing stress tests 1-2 months prior to go-live date to see the estimated real-world resource consumption of your application once it handles the full production traffic. This should give you enough time to identify potential bottlenecks and fix them before the go-live date.

Don’t hesitate to reach out to our customer success team if you have any questions.

Hosting Additional Applications

Our infrastructure is optimized for deploying the Alokai Storefront on React.js or Vue and Middleware that is part of the Alokai Connect layer. We know how to keep those applications fast and reliable, and we can advise you on how to build them to be fast, reliable, and resource-efficient. We cannot advise that for the additional applications, which are custom Node.js applications and we generally advise against using them unless it’s the last resort. Please contact our team if you think that you need to deploy a storefront-critical software other than Alokai Storefront and Middleware on our infrastructure. We will help you in assessing this need and partnering with you  for the best solution to your problem.