How to maintain a site with 5 million PV per month and 80 TB of forwarding for only 40,000 yen



Poly, which has released a 3D asset library to the public, how to maintain a popular website with 5 million PV monthly page views (PV) and 80 TB of data transfer for less than $ 400 (about 46,000 yen) Haven puts it together.

How we handle 80TB and 5M page views a month for under $ 400 – Poly Haven Blog
https://blog.polyhaven.com/how-we-handle-80tb-and-5m-page-views-a-month-for-under-400/

One of the points of website operation is 'how to manage financial resources'. Funds if Amazon S3 is easy to utilize the cloud platform, such as, when the amount of data transfer is using the Amazon S3 in the web site, such as Poly Haven, which is also the month 80TB, per month about 4000 dollars (about 460,000 It costs as much as yen).

Poly Haven is basically operated based on donations raised by Patreon , and if you use Amazon S3, all the donations of about $ 4000 collected every month will disappear to the server fee, and you will not be able to use other funds. increase.

That's why Poly Haven relies on 'Cloudflare.' Poly Haven calls Cloudflare a 'massive caching layer.' What this really means is that, for example, if a London-based Poly Haven user downloads a digital asset from the site, the data file will be fetched from the origin server and routed through Cloudflare's edge nodes. If another London-based user then downloads the same data file, Cloudflare caches this data so you can transfer the data file to the user without having to access the origin server.

Cloudflare users can set a cache period for their data, so content that is rarely accessed by the user should have the longest possible cache period, and content that is updated frequently should have a short cache period so that the latest data is correct. It is possible to reach the user.

In the case of Poly Haven, by making good use of Cloudflare's data cache, it seems that it has succeeded in covering 85% (orange line) of user's download traffic with Cloudflare's cache.



Poly Haven caches not only the data files that users download, but all the elements of the website (stylesheets, JavaScript, JSON data, etc.). This cache is more efficient than the download file cache, and Poly Haven has successfully cached about 93% of its traffic (excluding asset-related).



Poly Haven argues that by cashing most of the website, it is possible to reduce the utilization rate of the origin server and keep the maintenance cost of the website low. Cloudflare costs $ 20 per domain, and Poly Haven uses two domains, the main website 'polyhaven.com' and the asset download 'polyhaven.org'. Therefore, it seems that the cost of ' about 40 dollars (about 4600 yen) per month' will be required.

With Cloudflare, Poly Haven can handle about 85% of monthly traffic, but the remaining 15% must be handled by the origin server. In the case of Poly Haven, it seems that you will not be charged for download traffic at all because you are using

Backblaze's cloud storage 'B2 Cloud Storage' which is affiliated with Cloudflare. Therefore, it seems that the usage fee for B2 Cloud Storage is the total of the storage fee, upload cost, and some API request costs, ' about 11 dollars (about 1300 yen) per month '.



So far we've mentioned the cost of maintaining a server for users to download asset files from Poly Haven, but there's also the cost of running a separate website to display links and more. takes. The main website 'polyhaven.com' is built using the JavaScript framework Next.js. Next.js is a

Vercel application and can be used on its own server or cloud provider, but it seems that it can be easily used at a more affordable price by using Vercel's service. Also, if you use Vercel's service, you can build a site without a server.

The basic charge for Vercel's service is ' $ 20 per month ', and an additional charge will be required depending on the usage. In the case of Poly Haven, since Cloudflare is used as a caching layer, it seems that you will not be charged more than the basic fee.



In addition, Poly Haven uses Google's Cloud Firestore as a database for storing information such as which assets users have downloaded. Poly Haven says, 'Cloud Firestore is certainly not the cheapest option, and it costs about $ 100 a month .' That's about half the cost of running a website, but I understand it's still the right choice. '



In addition, Poly Haven is using

Vultr.com as a server to execute the API in order to reduce Vercel's billing amount. The API is for connecting the front-end website on Vercel to the database, and it is said that it costs only '$ 5 per month (about 580 yen)'.

Poly Haven cites the very high 'data transfer cache rate of 93%' as the reason why database and API costs are kept relatively low. And Cloudflare's ' Argo ' makes this possible. Use Argo to 'optimize DNS routes to improve latency' and 'route all global traffic through a small number of large data centers before being split into hundreds of edge nodes.' It will be possible. Specifically, 'If a user in London downloads Poly Haven's assets, Cloudflare will be able to cache the assets and transfer the cached data throughout Western Europe.'

It seems that the cache rate of the data transfer amount will be very high by using Argo, and in the case of Poly Haven it was 75% when not using Argo, but by using Argo it succeeded in increasing it to 93%. I am. However, you will have to pay some usage fee per 1GB of traffic passing through Argo's network.

Of the Poly Haven traffic, the traffic that passes through the Argo network is as follows.



Poly Haven uses two domains, '.com' and '.org', but in the '.com' domain, Argo is enabled and in the '.org' domain, which generates 80TB of data transfer volume. Argo is disabled. As a result, we have succeeded in reducing the usage fee of Argo to about 160 dollars (about 19,000 yen) per month.

Poly Haven also explains that using Argo offers benefits such as improved latency, reduced API server load, and reduced Vercel usage.



And the last service we use is bunny.net for hosting all the images that appear on our website. bunny.net also has an optimization service that allows you to dynamically resize and compress images, which improves the user experience of faster page loads and streamlines workflows (upload one PNG image). The service will output images of any size and format just by doing this).

In the case of Poly Haven, the monthly data transfer amount is 4.36 TB, and the usage fee of bunny.net is about 'about 27 dollars (about 3100 yen) per month '.



The total usage fee for these services is ' about 370 dollars (about 43,000 yen) ', and it is possible to operate Poly Haven for one month for less than 400 dollars.

in Web Service, Posted by logu_ii