夜斗天堂備用站  
  
查看: 1|回復: 0
打印 上一主題 下一主題

Don't use libraries and frameworks that

[複製鏈接]

1

主題

1

帖子

2

積分

新手上路

Rank: 1

積分
2
跳轉到指定樓層
樓主
發表於 2023-12-26 14:17:02 | 只看該作者 回帖獎勵 |倒序瀏覽 |閱讀模式
Or spread across many files you will find that it takes longer to read and interpret at runtime. Here are some things you can do to improve startup performance: Only include the code your function actually needs to do its job. load a lot of stuff you don't need. The general point here is that the less code you need to explain, the simpler your dependency tree will be. The processing speed is faster. Don't do more work than needed. Any value calculations or expensive operations that may be reused each time the function is called should be cached as variables outside the handler scope. Doing this avoids performing these expensive operations every time the function is called. Consider a situation where the values stored in the database change infrequently such as configurable redirects. Although this code works but the query to find the redirects is run every time the function is called. This is not ideal as it requires accessing the database to find the value you already found during the last call. A better way to write it is to first check the cached value outside the handler.

If not found then run the query and store the re photo editing servies sults for next time The query will now only run the first time the function is called. Any subsequent calls will use the cached value. One final thing to consider is using provisioned concurrency to keep things warm if you use them. According to the documentation note that provisioning concurrency initializes the requested number of execution environments so that they are ready to respond immediately to function calls. Please note that configuring provisioned concurrency will incur charges to your account. This allows you to maintain a specified number of available execution environments that can respond to requests without cold-starting. While this sounds great, there are some important things to remember that using provisioned concurrency will incur additional costs. Your application will never scale down to these.



These are important considerations as the added cost may be for your specific scenario. not worth it. Before taking this step we recommend that you look at the value it brings to your application and consider whether the added cost makes sense. Conclusion In this article we looked at some of the best practices we recommend for developers building and deploying serverless functions. The enhancements and best practices mentioned in this article are not intended to be an exhaustive list. To quickly recap we recommend that you host your database as close as possible to your deployed functions run as much code as possible outside of handlers cache reusable values and calculations as much as possible keep your functions as simple as possible if you If you're willing to deal with the financial trade-offs, please consider using Provisioned Concurrency. Thank you for your interest. We hope this information is helpful. Serverless Education. Don't miss the next article. Subscribe to the newsletter.


回復

使用道具 舉報

您需要登錄後才可以回帖 登錄 | 立即註冊

本版積分規則

快速回復 返回頂部 返回列表
一粒米 | 中興米 | 論壇美工 | 設計 抗ddos | 天堂私服 | ddos | ddos | 防ddos | 防禦ddos | 防ddos主機 | 天堂美工 | 設計 防ddos主機 | 抗ddos主機 | 抗ddos | 抗ddos主機 | 抗攻擊論壇 | 天堂自動贊助 | 免費論壇 | 天堂私服 | 天堂123 | 台南清潔 | 天堂 | 天堂私服 | 免費論壇申請 | 抗ddos | 虛擬主機 | 實體主機 | vps | 網域註冊 | 抗攻擊遊戲主機 | ddos |