当前位置:网站首页>Six lessons to be learned for the successful implementation of edge coding
Six lessons to be learned for the successful implementation of edge coding
2022-07-02 01:30:00 【Software testing network】
As companies rush to get the low latency that the edge can provide 、 flexibility 、 Cost and performance benefits , The demand for edge computing is expanding dramatically .IDC It is estimated that ,2022 Global edge hardware 、 Spending on software and services will reach 1760 Billion dollars , Increase over the previous year 14.8%, To 2025 The years will reach 2740 Billion dollars . therefore , Your developers are probably developing edge applications now , Or will do so in the near future .
However , Before you delve into it , There are some things to consider . As an enterprise architect, I have experience of cooperating with development organizations , Let me tell you some lessons when creating edge applications . Keeping these lessons in mind can help you avoid detours , And make sure you take advantage of the edge .
lesson 1: Challenge your way of thinking
A lot of times , When developers create edge applications , Just like they are used in data center or cloud . But edge is a different paradigm , You need to write code in different ways , We also need to use a thoughtful method to select applications suitable for the edge .
Most developers are used to centralized computing environments , There are a lot of computing resources in a small number of servers . however , Edge computing turns this situation around , Relatively modest resources are distributed on many servers in different locations . This may affect the scalability of any edge workload . for example , An application that uses a lot of memory may not scale well in hundreds of edge instances . For this reason , Most edge applications will be designed specifically for edges , Not from existing data centers or cloud deployments “ Promotion and migration ”.
You need to think carefully about how edge architecture affects your application , And which applications will benefit from this distributed approach . It is often easier to bring logic to where the data is located . therefore , If the data is more regional , Or you need to access large centralized data storage , A cloud based approach may be reasonable . however , When an application uses data generated at the edge -- For example, requests from online users / Respond to 、cookies And header information -- This is where edge computing really shines .
lesson 2: Don't ignore the basics
Although distributing code to the edge can improve latency and scalability , But it won't magically run faster . Inefficient code will be equally inefficient on the edge . As mentioned earlier , Every point of existence at the edge will be subject to more resource constraints than a typical centralized computing environment , Especially in the edge environment without servers . When writing code for edges , Optimizing efficiency is critical to making full use of this architecture .
When the push function to the edge is relatively fast and easy , You still need to apply a diligent management process like managing other code . This includes a good change management process , Store the code in source code control , And use code reviews to evaluate code quality .
lesson 3: Rethink scalability
On the edge , You are “ expand ” instead of “ increase ”. therefore , You need to develop code to accommodate the constraints of each request , Instead of considering the constraints of each server . This includes memory usage 、CPU Constraints on cycle and time per request . The constraints will vary depending on the edge platform you use , So it's important to understand them and design your code accordingly .
Generally speaking , You want to operate with the minimum data set required for each operation . for example , If you do it on the edge A/B test , You just want to store a subset of the data you need for the specific request or page you are working on , Instead of the entire rule set . For location-based experience , You only need to save the data of the specific state or region served by the edge instance in a lightweight query , Not data from all regions .
lesson 4: Code for reliability
Ensuring the reliability of edge applications is absolutely necessary to provide a positive user experience . Please make sure that in your QA The plan includes testing edge code . It is also important to add appropriate error handling , To ensure that your code can handle errors gracefully , It includes the fallback behavior when planning and testing events occur . for example , If your code exceeds the platform limit , To create a fallback to some default content , In this way, users will not receive an error message that affects their experience .
Distributed load testing is a good practice , You can confirm the scalability of your application . Once you deploy the code , Continue to monitor the platform , To make sure it doesn't exceed CPU And memory limitations , And track any errors .
lesson 5: Optimize performance
The main benefit of edge computing is to significantly reduce latency by moving data and computing resources near users . When you are in hundreds of places (PoPs) When expanding on , Create lightweight 、 Efficient code is critical to achieving this benefit . The data needed to complete a function should also be on the edge . Developing code that needs to get data from centralized data storage will erase the latency advantage provided by the edge .
The emphasis on efficient execution also applies to any third-party code utilized by edge applications . Some existing code bases are inefficient , Damage the performance or exceed the edge platform CPU And memory limits . therefore , Before incorporating any code into edge deployment , Evaluate it carefully .
lesson 6: Don't make wheels over and over again
Although the edge is a new pattern , But that doesn't mean you have to write everything from scratch . Most edge platforms are connected to various content distribution networks (CDN) Functional integration , Allows you to create custom logic , Generate an output signal , Prompt existing CDN function , Caching .
It's also a good idea to design your code to be reusable , In this way, it can be executed both at the edge and in a centralized computing environment . Abstract the core functions as browser independent 、Node.JS Or a library of platform specific functions , You can make the code have “ Isomorphism ”, Can be on the client 、 Servers and edges run .
Using existing open source libraries is another way to avoid rewriting common functions . But pay attention to those who need Node.JS Or the library of browser functions . And consider cooperating with third-party developers who integrate with the edge platform you are using , This can save time and energy , At the same time, it provides mature interoperability advantages .
Put these experiences into practice
To illustrate the impact of these best practices , Please consider a real case : An organization encountered difficulties in implementing geofencing applications at the edge . They met people who exceeded the platform CPU And high error rate caused by memory limitation .
See how they build their own applications , They have data on all geographically fenced areas ,900KB Of JSON, Stored on each edge PoP in . Use one CPU Dense algorithm to check the interest points of each geographical fence , When no point of interest is found in the first few areas , It will trigger CPU Overtime .
To solve this problem , The data of each geo fenced area is transferred to a key value store (KVS) in , Each area is stored in a separate entry . Added a lightweight check , To determine the possibility of a point of interest “ candidate region ”( Usually 1 To 3 Candidate areas ). Complete data and CPU Intensive inspection is only carried out in candidate areas , Greatly reduced CPU The amount of work . These changes reduce the error rate to a negligible level , At the same time, it improves the initialization time and reduces the use of memory , As shown in the figure below .
chart 1: Comparison of success rate and error rate ( Be careful , The scale of success and error indicators are different , So you can't directly compare ).
chart 2: Comparison of initialization time
chart 3: Compare the memory usage before and after ( picture source :Akamai)
Give full play to the role of the edge
The edge calculation is close to the user 、 Applications that provide personalized user experience quickly and efficiently offer great advantages . The key to success is to ensure that the application is a good candidate for edge platforms , Then optimize your code , To make full use of the functions of the edge platform , At the same time, work under its limited conditions .
Please pay attention to the lessons I have learned in working with organizations , You can get the edge advantage faster , And there is no headache .
边栏推荐
- Brief introduction to the development of mobile network
- Bat Android Engineer interview process analysis + restore the most authentic and complete first-line company interview questions
- Day 13 of hcip (relevant contents of BGP agreement)
- 969 interlaced string
- Convolutional neural network (including code and corresponding diagram)
- 技术大佬准备就绪,话题C位由你决定
- KS006基于SSM实现学生成绩管理系统
- CEPH buffer yyds dry inventory
- Ubuntu20.04 PostgreSQL 14 installation configuration record
- How does schedulerx help users solve the problem of distributed task scheduling?
猜你喜欢
969 interlaced string
Self drawing of menu items and CListBox items
Principle of finding combinatorial number and template code
[dynamic planning] interval dp:p3205 Chorus
About asp Net core uses a small detail of datetime date type parameter
LeetCode、3无重复最长子序列
6-3漏洞利用-SSH环境搭建
Hcip day 14 (MPLS protocol)
[rust web rokcet Series 1] Hello, world and get, post, put, delete
We should make clear the branch prediction
随机推荐
人工智能在网络安全中的作用
只是以消费互联网的方式和方法来落地和实践产业互联网,并不能够带来长久的发展
站在新的角度来看待产业互联网,并且去寻求产业互联网的正确方式和方法
技术大佬准备就绪,话题C位由你决定
II Basic structure of radio energy transmission system
Docker安装Oracle_11g
笔者更加愿意将产业互联网看成是一个比消费互联网要丰富得多的概念
游戏思考15:全区全服和分区分服的思考
教你白嫖Amazon rds一年并搭建MySQL云数据库(只需10分钟,真香)
Exclusive delivery of secret script move disassembly (the first time)
matlab 使用 resample 完成重采样
[IVX junior engineer training course 10 papers] 05 canvas and aircraft war game production
[Obsidian] wechat is sent to Obsidian using remotely save S3 compatibility
Part 29 supplement (XXIX) basis of ECMAScript
Hcip day 14 (MPLS protocol)
10 minutes to get started quickly composition API (setup syntax sugar writing method)
Basic concepts of machine learning
Load and domcontentloaded in JS
Self drawing of menu items and CListBox items
遊戲思考15:全區全服和分區分服的思考