Implementation of Fuzzy Inference System with Best-Worst Method for Cost Efficiency on Amazon Web Services

ABSTRACT


Introduction
Virtualization is a process of utilizing hardware more efficiently. The concept of virtualization is the basis of cloud computing technology (Rashid & Chaturvedi, 2019). One of the leading cloud service providers in the world is Amazon Web Services (AWS). AWS services that are dedicated to performing compute workloads are called Elastic Compute Cloud (EC2). Instances on EC2 are virtual servers for running applications that can be rented and configured by users. AWS has 3 rental options on EC2 services namely On Demand Instance, Spot Instance, and Reserved Instance (Choudhary, 2021). On Demand Instances are regular instances that are paid per second of use with no long-term commitment. Spot Instances are surplus/backup/remaining instances of an AWS data center that are leased to users. As for Reserved Instances, users must commit to using the instance for one to three years to get a discount.
One of the goals of cloud computing services is to reduce costs. Although the cloud has a pay-as-you-go tendency or pay according to the resources used, the total cost of use may exceed the estimated budget (Alalawi & Al-Omary, 2020). AWS has several cost-saving mechanisms, one of which is Spot Instances which can provide discounts of up to 90% but there is a limitation that Amazon reserves the right to preempt Spot Instances at any time (López García et al., 2019).
Surplus VM tends to be a computing solution for some people because the cost is much cheaper than VM On Demand. In the research by Haugerud et al, (2020), an automation system has been developed using Google Cloud Platform (GCP) services that can shift workloads from Preemptible VMs to another. There are various methods and algorithms that can be used to build similar systems, such as the Greedy Algorithm (Haugerud et al., 2020), Neural Network (Domanal & Reddy, 2018, Modified Particle Swarm Optimization (Jana et al., 2019), Ant Colony Optimization (Tawfeek et al., 2015), Fuzzy Dominance Sort Based HEFT (Zhou et al., 2019), and Fuzzy Logic Controller (Oikonomou et al., 2020) which are capable of selecting cloud resources in automation systems.
Fuzzy logic is a multi-criteria decision-making system based on expert knowledge (Abbaspour-Gilandeh & Abbaspour-Gilandeh, 2019). This method is often used to deal with the concept of partial truth, whose truth value is between 1 (true) and 0 (false). With fuzzy logic, output with precise and detailed values can be generated from crisp input values that are not clear and inaccurate (fuzzy). The crisp input is carried out by the process of fuzzification, application of rules, and defuzzification. Fuzzy logic requires variables as a consideration to produce output but there is no level of importance assigned to these variables. To give importance to each variable, the Best-Worst Method (BWM) can be used.
BWM is a multi-criteria decision-making method (MCDM) proposed by Dr. Jafar Rezaei in 2015. The BWM can be applied to problems where flexibility is expected (non-linear) or not (linear). Comparison of BWM against other multi-criteria decision-making methods such as the Analytic Hierarchy Process (AHP) shows that BWM requires fewer comparisons, produces more consistent final weights, can be combined with other multi-criteria decision-making methods, and is easier to use because it only contains integer data required in the comparison matrix (Rezaei, 2015).

Spot Instance Selection Automation System
This research focuses on how to maximize the use of surplus resources on Amazon Web Services and at the same time reduce the cost of using AWS computing services. The proposed solution is an automation system to select and run EC2 Spot Instance types based on price, discount, amount of memory, and vCPU usage from the previous running instance. The Spot Instance Selection Automation System is built with the implementation of fuzzy inference system for the first selection stage and BWM for the second and is deployed in Lambda function. With the help of the EventBridge service, Lambda function can be triggered automatically whenever AWS sends the termination signal. The system uses input data from both Boto3 method calls and Amazon CloudWatch metrics.

Fuzzy Inference System
Fuzzy inference system with the Sugeno method is used to build the first selection stage in the Spot Instance selection system. This method allows for the members of the set of consequent variables in the form of constants or equations. This first stage serves to select EC2 Spot instances based on vCPU usage in the last five minutes. There are two variables that affect the number of vCPUs to be selected, these variables are divided into two, namely premise variables consisting of Current vCPU and vCPU Usage. Meanwhile, the consequent variable is vCPU Verdict. table 1 shows detailed sets on each fuzzy variable.  (1) Rule (1)  (2) 1 , 2 , …, ( ) = + 1 1 + 2 2 + … + The Minimum (Min) Function is used for each rule in the inference stage. And use the Maximum Function (Max) in the composition between the rules. The defuzzification process is carried out after the inference process is formed (Selvaraj et al., 2020).
Fuzzy rules are created based on changes in the number of vCPUs. There are two premise variables each with three fuzzy set members, therefore the total number of possible fuzzy rules is 32 = 9 as shown in table 2.  It seen from table 3 that the z value is not a number that can be directly processed for the Spot Instance selection stage because the number of vCPUs available is only 2, 4, and 8. The adjustment process is carried out by applying a subtraction operation with the input data of the number of vCPUs (Current vCPU) on the output value. This operation produces a value that can be used as a reference in the selection of Spot Instances whether or not to reduce or increase the number of vCPUs.

Best-Worst Method (BWM)
In this study, BWM is used as a method for selecting Spot Instances on AWS based on the amount of memory. The selection using BWM is the second stage of selection after the selection with a fuzzy inference system which if the results are two. The BWM model implemented is a linear model. Using this model, one global optimal solution is obtained.
There are five steps in the BWM method (Kheybari et al., 2019). It starts by defining the set of criteria. Furthermore, from these criteria the best and worst criteria are determined. Followed by determining the level of importance between the best criteria and all criteria (Best-to-Others). The fourth step is to determine the importance of all criteria with the worst criteria (Others-to-Worst). Finally, calculate the optimal weight with the min-max model. Three criteria are used: total memory, lowest price, and highest discount. The Total Memory criterion is used because the purpose of implementing BWM is to select a Spot Instance based on memory. While the other two criterions are taken based on the objective of this study: price efficiency.
In its implementation, BWM requires data from experts. Experts in this study were described as people who passed the cloud certification exam at least professional level in the past two years. This data is used to determine the best and worst criteria as well as the Best-to-Others (BO) and Others-to-Worst (OW) scores. From these data, it can be determined that the best criteria is total memory, the worst is highest discount, the Best-to-Others vector is BO = (1, 6, 5), and the Others-to-Worst vector is OW = (8, 6, 1). The optimal weight value for the total memory criterion is 0.74, the lowest price criterion is 0.18, and the highest discount criterion is 0.08. This calculation also calculates a reliability level of 0.32 (a value close to 0 indicates that it is more reliable, while a value close to 1 less reliable).

Integration of AWS Services
AWS service integration begins by manually setting up the required AWS resources in the ap-southeast-3 (Jakarta) region via console such as EC2 Spot Instance, CloudWatch, EventBridge, and Lambda. The Jakarta region was chosen because the region is the closest to the research location. In EC2 Spot Instance, the Stress-ng tool will be installed. This tool serves to dynamically manipulate the workload on the vCPU instance. The AWS architecture is depicted in figure 1. Spot Instances can be terminated by AWS at any time for various reasons. To overcome this, the researcher uses the EventBridge service to capture the termination signal and then trigger Lambda to run the Spot Instance selection system. Amazon CloudWatch is used to monitor vCPU usage of Spot Instances. This data will later be used as input data for the Spot Instance selection automation system. And since the experiment will only run for four days, it is not effective to only rely on termination signals from AWS which the researchers themselves do not know when the signal will be sent. So, to prevent the possibility of a termination signal not being sent by AWS during the experiment, the researchers conducted a system test using the Send Events feature in EventBridge.

Results and Discussion
Researchers created and sent a termination event simulation six times at different times. The total usage cost of Spot Instance can be seen on the AWS cost management service console page using the cost explorer feature. Through this feature, researchers can find out the total usage cost of Spot Instance by setting the "resource" filter and adding six instance ids from the instances selected. table 4 shows a breakdown of the cost of using Spot Instances. The next step after getting the total cost of using Spot Instance is to calculate the range of total cost of using EC2 On Demand with adjusted uptime and instance type. For this stage the researcher uses the AWS Pricing Calculator. The estimates provided by the service are monthly estimates. Therefore, it is necessary to divide the estimation by 30 so that the resulting figure is a daily estimate. table 5 shows the results of the estimated cost of using EC2 On Demand. The results of the calculation show that the discounted price obtained from the use of EC2 Spot Instances is 71.28% of the cost of using EC2 On Demand. This study also proves that the application of a fuzzy inference system with the BWM method can automate the launch of new Spot Instances according to vCPU usage when the old Spot Instances experience termination from AWS so that instances are always available.

Conclusion
The topic of this research is the cost efficiency of using Amazon Web Services (AWS) computing services. There are two methods used, namely fuzzy inference system and Best-Worst Method (BWM). The fuzzy inference system is implemented using the Sugeno method. The first step the researcher did was to implement a fuzzy inference system using the Sugeno method for the selection of stage one in the AWS Spot Instance Selection automation system. The implementation includes determining variables, fuzzy sets, membership functions, and fuzzy rules, as well as applying the Sugeno method in fuzzy inference systems and also the defuzzification process that produces z values. Next, the researcher applies the BWM for the second stage selection on instances that have two vCPUs. BWM uses data from experts to determine which criteria are the best and worst and determine the values of the Best-to-Others (BO) and Others-to-Worst (OW) vectors. From the resulting optimal weight, it can produce an output in the form of a Spot Instance decision with calculations using data from the performance matrix. The third stage is the integration of several AWS services including EventBridge, Lambda, CloudWatch, and EC2.
During the 4 four days the system was running, the simulation signal was sent six times and the system succeeded in requesting a new Spot Instance with specifications that matched the input data. Based on the researcher's evaluation, it was found that the reduced cost of AWS computing services was 71.28% of the EC2 On Demand service.