## 2 Literature Review  
According to [3; 6], the challenges of performing service composition in IoT were heterogeneity and the rapid increase in the number of devices and services [7], including the costs of service composition in IoT, which were yet to be solved. Additionally, other issues raised by the researchers were the monitoring mechanisms of service composition that should be implemented, in which the consideration of most researchers was only on the availability and unavailability of the services or other Quality of Services (QoS) attributes. According to the authors, the motivations for the adaption of service could be summarized in two points, one to ensure continuity of services to the user, and two, to improve the user interaction with the environment. There were some comparative studies conducted by researchers, but due to lack of implementation, there were no results to prove the suitable approach to solve the challenges. As mentioned by [8], the aim of their research was to present the comparative investigation of the selected service composition techniques in the IoT. They presented comparisons between the similarities and alterations among the current service composition in the IoT based on appropriate parameters. The authors also determined the important areas where future research could expand the service composition techniques in the IoT by offering the comparison and briefing techniques; however, the author claimed that most of the articles tried to improve execution time, scalability, and cost, but availability and reliability were rarely considered. Based on the finding by [9], a traditional optimization technique was applied to solve the selection and composition of cloud services; however, it still suffered from slow convergence speed, a large number of calculations, and falling into local optimum. The author also reported that user dissatisfaction or violation of the Service Level Agreement (SLA) was a major problem. Thus, the author proposed a hybrid optimization method with the combination of Particle Swarm Optimization (PSO) and the Fruit Fly Optimization Algorithm (FOA) to improve the performance in terms of fitness value, execution time, and error rate; however, the proposed methods had a drawback on computation time for large-scale implementation. As explained by [10], the number of web services is increasing dramatically, which results in difficulties for users to find the desired web services. The author claimed that most of the existing methods recommend services according to accurate prediction on rating or QoS values. Thus, the author proposed a model named Support Vector Machine (SVM)-based Collaborative Filtering (CF) Service Recommendation Approach (SVMCF4 SR) to correctly rank the services rather than to accurately predict based on historical data--in this case, good QoS value services will be ignored depending on user ratings. Ref. [11] stated that the QoS-aware cloud service composition problem is also known as the NP-hard problem, and many methods are studied to solve this issue and yet cannot solve it due to the large scale and growing repository. A Hybrid Genetic Algorithm (HGA) method was proposed to solve the composition problem. The proposed HGA method is the combination of a Genetic Algorithm (GA) and FOA. GA is a method widely used to solve several optimization problems, whereas FOA was inspired by the food-finding behavior of fruit flies. FOA was employed for local search to maintain the balance between exploration and exploitation. In this case, the scenario is yet to be tested in the distributed cloud environment. Distance plays an important role in the K-means algorithm to find the point-to-point distance between web services. According to [12], Manhattan distance achieves good results. In the Manhattan distance function, the distance between two points is the sum of the absolute differences of their Cartesian coordinates.