# Mobile Edge Computing - A key technology towards 5G
## What is 5G?
- It is short for "5th Generation", the name of currently using mobile network.
### Difference between 4G and 5G
1. Speed:
| Generation | Theoretical Speed | Technology | Features |
| ---------- | ----------------- | ---------- | ---------|
| 4G | 100~300Mbps | LTE | Fast download speeds open the way for HD Streaming. |
| 5G | 10~30Gbps | Developing | Ultra-fast internet, low-latency, and improved reliability.|
2. Spectrum:
- While we were using network, we were actually using a tiny piece of the total network spectrum owned by the network operator.
- This blocks of spectrum create the total network capacity and is becoming less while the user increasing.
- Since 5G has nearly hundred times more capacity than 4G, this challenge may be solved.
3. Latency Rates:
- Latency is a term which measures how long a signal will takes from its source to the receiver and then reverse.
- In 4G networks, the latency rate is approximately 40 to 50 milliseconds. On the other hand, the latency rate of 5G is significantly lower than 4G, and it is only one millisecond in 5G.
| Technologies Features | 1G | 2G | 3G | 4G | 5G |
| --------------------- | ----- | ----------- | ----- | ------------------------------ | -- |
| Data Rate | 2kbps | 14.4~64kbps | 2Mbps | 200Mbps~1Gbps for low mobility | 10~100Gbps |
| Services | Voice | Digital Voice+SMS | Integrated high quality video | Dynamics Information access | Wearable Devices with AI capabilities |
Table 1: All generation of Network.
## The Challenge of Implementing 5G

- Although 5G seems a lot better than 4G, its implementation is not simple at all.
- To meet requirements stated above, we will need to upgrade the entire front to backend network topology and this is extremely costly without efficiency.
- Therefore, we now introduce MEC architecture and how its work with the utilization of NFV to serve the general purpose of implementation of Virtual Evolved Packet Core, which may replaced the expensive proprietary hardware and software.
## Edge Computing

- Essentially, edge computing refers to the concept of computing as close as possible to where data is created and commands are executed.
- It suggest an IT service environment and cloud-computing capabilities at the edge of the mobile network, within the Radio Access Network(RAN) and in close proximity to mobile subscribers.
- This may leads to latency reduction, highly efficient network operation and service delivery.
### MEC
- Mobile Edge Computing, also known as Multi-access Edge Computing, is a new technology which accomplish the concept of edge computing.
- It is based on a virtualized platform, with an approach complementary to NFV(Network Function Virtualization, used for network functions)
### Some applications of MEC
1. Augmented Reality
- AR is the combination of a view of the real-world environment and supplementary computer generated sensory input(like sound, video,...)
- AR services require an application to analyse some data, such as the output from a device's camara or the device's precise location.
- Therefore, hosting the AR on a MEC platform instead of in the cloud is much more advantageous since supplementary information pertaining to a point of interest is highly localised and is often irrelevant beyond the particular point of interest.

2. Intelligent Video Application
3. Connected Cars
4. Internet of Things Gateway
## ETSI Industry Specification Group on Mobile Edge Computing
- ETSI enable the hosting of third-party applications in a multi-vendor MEC environment.
- Initial scope focused on use cases, specifies the requirement and the reference architecture.
- After that, the MEC platform API will be application-agnostic and allow the smooth porting of value-creating on each ME server with guranteed SLA.

---
# Developing Software for Multi-Access Edge Computing
## The need for an evolved approach
- MEC offers to applications developers and content providers cloud-computing capabilities and IT services environment at the edge of the network, which evolves the environment.
- The new development model is with 3 locations:
1. Client
- Either traditional smartphone or other wireless connected compute element
2. Near Server
3. Far Server

As shown above, a MEC host is usually deployed at the network edge, contains a MEC paltform and the compute, storage and network resources for applications in VMs or containers.
## Designing with Edge in Mind
- Hour-Glass Model is usually introduced when it comes to the design of a modern system. It states that applications and networks should be completely agnostic to each other.
- The environment enabled by MEC platform is where the network and the applications can converge in a meaningful wat without giving up the key benefits of hour-glass model.
- While the MEC can support any applications, it can also offer additional services to those have been designed to be MEC-aware.
- Thus, it emerged a key aspect of software design for MEC. That is, the end-to-end service can be splitted into three applications:
1. Terminal Device Components.
2. Edge Components.
3. Remote Components.

## Architecting and Developing for the Edge
- This section shall describes how an application is deployed in a MEC system.
1. There are 2 APIs(Mx2 API & Mp1 API) should be considered.
- Mx2 allows a device application to interact with the MEC system.
- Mp1 is the reference point between MEC applications and the MEC platform.(To allow applications to interact with MEC system)
2. On the other hand, depending on whether the applications wishes to consume MEC services, there are also specific service-related APIs that developers may want to consider such as Location API or Radio Network Information API.
3. The followings show some preliminary high-level considerations while deploying application in MEC:
1. DNS-based solution:
- Applications have to been designed to support a DNS-based solution for traffic redirection.
2. Domain name:
- Register a name for the service(FQDN), which is known to client application to gain access.
3. Cloud back-end:
- Back-end service will be required if there is a need for the service to be available no matter the local MEC system exists or not.
4. Sensitive user context data:
- As the context data of users from one jurisdiction may be illegal in another, we should handle this kind of cases if application mobility is to be supported.
5. Packaging the application:
- Since the packaging of application is inextricably linked to the ru-time environment of the MEC system, developers should needs to adapt accordingly.
6. Provide meta-data with application requirements:
- The application needs to be provided with its requirements such as latency tolerance, network resources, storage resources, CPU etc.
---
- To facilitate MEC application design, MEC communications can be divided into several phases.
1. Phase 1: MEC application packaging & on-boarding.
2. Phase 2: MEC application instantiation.
3. Phase 3: communication between client-side app and MEC app.
4. Phase 4: usage of the MEC platform and services.
## Phase 1: MEC application Packaging & On-boarding.
- MEC applications are usually packaged and set up as a VM or Container, with all the necessary dependencies according to the specific MEC platform's requirements and configurations.
- There are various options exist to package and onboard applications within a MEC environment which likely will have contractual considerations between the interested parties. Thus, we will not specific the details of applications onboarding that are not defined by the standard.

- The above shows the high-level details and steps of applications onboarding.
1.When the OSS receives requests for managing of applications, it makes decision on whether to grant these requests.
2.Granted requests will be forwarded to MEO and MEO has the responsibility of onboarding MEC applications into MEC systems.
- Checking integrity, authenticity of signed packages,...
3.MEO will assign an ID to the application package and provides the MEPM with the location of the application image.
4.MEPM is responsible to prepares VIMs which selected by MEO for application instantiation. After on-boarding, the package is in "Enabled, Not in Use" state.
5.Thus, OSS may now perform the application lifecycle management actions such as package enable, disable, query or deletion commands.
## Phase 2: MEC app instance instantiation and operation.
- As the application innitialization may be triggered from a device or OSS:
1. If from device, a developer will be able to interact directly with the MEC system through a device with a client supporting Mx2 API.
- Since UALCMP exposes Mx2 PI to the device application, the device app may then request the following operations:
- query the available applications
- instantiation and deletion of an application,...
2. Direct interaction between developer and MEC operator without device app, the MEC operator is then triggers the application on-boarding and instantiation through the OSS.
---
### The client perspective
- In order to have direct interaction with MEC system, device application requires subscription with MEC operator.
- The device app will first be authenticates and then gets authorized to the operator's AA server, which will provides the access token to Mx2 API.
- Beside of the option of Mx2 API, the developer may also request for instantiation if the application image is already available in the MEC system.
- The available option to be instantiated may be enquired by Mx2 API.
- To provide the application package, developers may provide a link contains the image and descriptor in order to have the MEC system to retrieve and instantiate it.
- After that, the address of the application instance will be convey. Once the device app receive the address for the MEC application, the developer may then disseminate it among the target audience.
### The MEC platform perspective
- The instantiation of MEC app is initialized by the OSS and OSS will forwards the granted instantiation to the MEO. After that, MEO will selects the target MEP adn forwards the request to selected MEPM.
- An instantiation request should be containing the details about the running of app, app rules/requirement,...
- MEPM can send lifecycle requests to the VIMs for allocating virtualized resources and instantiation of MEC application.
- Once set up, MEC app is enabled to interact with MEP through Mp1 to perform certain support procedure.
- MEPM also receives virtualized resources fault report and performance measurement from VIM for further processing and updates the initial set-up information accordingly.
- After the application has been instantiated, by using the application lifecycle management APIs, developers can always perform the operation "Start"/"Stop" to run/stop the service.
- When an operation is invoked, the app lifecycle management will trigger a special task to track the operation.
## Phase 3: Client-side app and MEC app communication

- Normally, a device app is separated from the actual client app(the one request service from MEC app).
- Client app: unaware of the edge deployment of the server application.
- Device app: needed for invoking user app lifecycle management operations on MEC system's management plane.
- For the client app to connect with MEC app instance:
1. Developer makes the address of the MEC app which receives from the MEC system
2. Client app discovers the MEC app instance via DNS look-up.
## Phase 4: Usage of the MEC platform and services
- Once the MEC app becomes operational, it may consume MEC service as the following.
- RESTful Design:
- Since the MEC specific APIs are built upon RESTful APIs which is an API that uses the HTTP protocol as a tunnel or transfer mechanism for interaction between remote entities.

### Radio Network Information API
- While low-level information on current radio conditions is available in the RAN, MEC server is in relative proximity and connected to the base station.
- RNIS is a service that provides radio network related information to authorized MEC applications and the MEC platform.
- The RNI may be used by MEC app or platform to optimize the existing services and to provide new services.
- E.g. Bitrate Recommendations for video or voice calls
- Usually, the service consumers interact with the RNIS over the RNI API to obtain contextual information from the radio access network.
### Location API
- Since the location information is important to many services, MEC create LS which can provides location-related information to its platform or authorized applications.
- The LS is registered and discovered over the Mp1 reference point.
- LS is available through its API to obtain location information, or the radio nodes associated with a MEC host.
- E.g. Active Device Location Tracking.
- It is possible to provide the distance between a specified UEs.
### Bandwidth Manager API
- As there will be data traffic associated with different MEC application, BWMS allows a fair distribution of bandwidth resources between applications.
- BWM API enables registered MEC applications to request a specific bandwidth allocation.
### UE Identity API
- The UE identity API provides functionality for a MEC application to register/deregister a tag or a list of tags in the MEC platform.
- Each tag maps to a specific UE in the mobile network operator's system.
---
## Building your first MEC application
- ISG MEC has published OAS which may offers an open source framework for defining and creating RESTful APIs.
- YAML (or JSON) interface files compliant to the OAS are both human machine-readable, it provide multiple services such as RESTful web service.
- Based on the interface file clients, it can understand and consume services without access to server code or the knowledge of server implementation.
- Swagger Editor enables server and client stubs, to be automatically generated for each of the MEC APIs and used as the starting point in the creation of a MEC application.

- Developer may use third party tools such as postman to interact with the server from a client perspective.
- Third party libraries have also ben developed to interact with interface files directly, thereby removing the server dependency.
- This then offers the capability for various API methods to be called from with the HTML files.
- In the nutshell, "Generate Client" option may be selected in order to generate a client interacts with server.
## Other aspects relavant for developers
### Implementation Aspects
- Different level of HW and SW security mitigations are recommended.
- For HW, HSM/TPM is recommended.
- For SW, TLS is recommended.
- To prevent illegal access, MEC system secure the environment for running services for the following actors:
- User, Network Operator, Third-Party application Provider, Application Developers, Content Provider, Platform Vendor,...
### Security
- MEC presents unique security challenges as well as opportunity when it comes to the specifies of edge computing.
- Challenges:
1. Limited compute capabilities and costlier factor cause MEC mini-cloud easier to be attacked.
2. Physical security is one of the most important factor with edge computing.
3. New security attack due to more entry points into the application.
- Opportunities:
1. The collection of edge and cloud taken together presents a much more challenging attack surface than a centralized cloud.
2. Limited Reachability make more difficult to perpetrate a DDoS attack.
3. Since the MEC host location is much closer to the access network than the core network, every network blocking resulting from attack will have a much smaller impact on the overall network.
### Mobility
- Since the terminal is likely a mobile device which the current MEC host may not the best choice of the device's location, MEC system allows the relocation of the user from one application instance to another running in a MEC host closer to the user.

- Application Mobility is triggered by the change in the device bearer path in the underlying transport network.
- User context synchronization depends on the application implementation:
- For stateless application, it can be relocated to another MEC host without using the mobiity service.
- For stateful application, it will require further application logic to transfer the user context from the source to the target application instance to maintain the service continuity.
- MEC application mobility service have 2 approaches:
- Store the context in the client app of user device, it is required to send to the target application after the relocation.
- Store the context in the MEC application instance, the application is required to support the capability to transfer the context between MEC application instances.
## Concluding Remarks
- The statement above addressed the issues that application developers face when developing applications for edge computing, including MEC-based edge computing.