Graph-QL Responsibility Analysis at Integrated Competency Certification Test System Base on Web Service

Graph-QL (Query Language) is a new concept in the Application Programming Interface (API). Graph-QL was developed by Facebook which is implemented on the server-side. Although it is a query language, Graph-QL is not directly related to the database, in other words, Graph-QL is not limited to certain databases, either SQL or NoSQL. The position of Graph-QL is on the client and server-side that access an API. One of the objectives of developing this query language is to facilitate data communication between the backend and frontend / mobile applications. For this reason, this paper will examine the responsibility of Graph-QL in terms of response time and response size in the development of an integrated competency certification test system based on web service and compared with efficiency and flexibility using the REST API. From the test results, it was found that Graph-QL provided some advantages compare to REST API. It give more flexibility for the clients to access the data and solve the most typical problem that was over or under fetching cause by fixed data given by REST API endpoints.


Introduction
Graph-QL is a server-side query and runtime language for Application Programming Interfaces (API) that prioritizes giving clients data exactly what they request [1]. In essence, Graph-QL is a language f or querying databases f rom client-side applications [2]. On the backend, Graph-QL can specify to the API how the data is presented to the client. It is also designed to make APIs faster, more f lexible and developer f riendly [3]. As a REST alternative, Graph-QL allows developers to make requests that pull data from multiple data sources in a single APIs endpoint [4]. In addition, the API manager will also have the f lexibility to be able add and remove f ields without having af f ect to existing queries [5]. Developers can also build APIs by any method they want. To prove that Graph-QL has a f airly good responsibility, this paper is implemented in the manufacture and testing of an integrated competency certification test system, and compared using the REST API [6].
Some previous studies related to Graph-QL, among others in ref erence [7] is analyzing the calculation of performance of Graph-QL and RESTful technology in the web information service system of the Institute f or Research and Community Service Hasanuddin University [7]. The perf ormance parameters used are Response Time and Throughput, with RESTf ul speeds still superior to Graph-QL because RESTful speeds are consistently stable in terms of access time and data size. Whereas Graph-QL is dynamic because it can change depending on demand f luctuations.
Another researcher [8] showed in his research that Graph-QL can reduce the size of the JSON document returned by REST APIs in 94% (in the number of f ields) and 99% (in the number of bytes), both of which are median results, but the dataset is used in this paper includes gray literature articles, migrated system source code, and queries used in runtime evaluation publicly available at https://github.com/gleisonbt/migrating-to-graphql [8].
Another case with another researcher, in reference [9], where the purpose stated in his papers to understand the properties of language in the Facebook initial, by providing semantic f ormal queries [9]. After that, language analysis is performed and shows that the language has very low complexity f or evaluation. This paper only compares the Graph-QL request language with the classic request language, which is the acyclic conjunctive query language (ACQ). Research on Advanced Data Retrieval with Graph-QL: a case study in Case Bakery Services, where this paper also studies and compares two data collection approaches. REST and Graph-QL in the context of case studies for web applications (Bakery Service applications), however, this paper does not consider aspects such as caching, mutation, and security [10].
From some of the research above, it f ocuses on comparing performance of the Graph-QL with the REST API based on aspects of Mutation, Query, and Type before using Data Manipulation Language (DML) [11], whereas in the paper presented here, it has novelty, which is about responsibility analysis of Graph-QL on the response time and response size, and also comparing with REST in making an integrated system of "competency certification test" based on web services which based on time and size of the response, and compare it with REST, and also f ocuses on several aspects including Mutation which is an operation that involves changes in the database, Query is an operation to take data in the database, and Types are almost the same like classes in programming languages, and include aspects such as caching, mutation, and security [12].
The steps for testing the responsibility of Graph-QL, first is the initial step to create an integrated system of "competency certification testing" based on web services and b uild API REST and Graph-QL APIs [13], then test each of the APIs above. The goal is the Graph-QL approach can be set any conditions or data needed by a query in the manuf acture of a system so that all data as needed without additional information that is not needed. With hope that using Graph-QL will be more efficient and flexible to get data [14].

Reseach Methods
The research began by building an integrated system of competency tests then input the data into the database. This system will be built with 2 concepts in the API, Graph-QL and REST [15], the data will be used as output requests f rom clients, then test and comparing the performance of each API concept that has been built using the characteristics of QoS (Quality of Service). As shown in Figure 1. Graph-QL test system design and REST APIs [16] [17].
The experiment was carried out, namely conducting an experiment to access the API endpoint of Graph-QL and REST which has been applied to the integrated competency test system. The f actors that will be used as a comparison in this study are the speed, size, and effectiveness of the response from Graph-QL and REST.

Building an information system Competency test
A competency test is a process of assessment both technical and non-technical through the collection of a relevant test to determine whether a person is competent or not yet competent in a Competency Unit or certain qualifications. The competency test system is built based on problems in data processing and distribution in the competency certification process at a professional certification Institution [18]. This system has 3 role users namely admin, assessor, and assessee (competency test participants). In this system, the assessment has the role to register with the system, f ill in the APL 1 f orm, register professional certif ication, and fill in the APL-2 Self Assessment f orm. The assessor has the role to verify the registration of assesse, check the assessee's Self Assessments APL-2 f orm, conduct the assessment, f ill in the observation f orm, portfolio, and decide the results of the assessee graduation with the assessment record form. Admin in this system has the role to manage the competency scheme data, manage the competency test data site, select assessors f or each assessee who register, manage the assessor user, verify the registration of the assessment and create a competency test schedule.

Figure 1. Design of Graph-QL test systems and REST API
This system is built using an API [19] that allows f or multiplatform system development. The f ire concept used is Graph-QL which consists of 24 types of objects, 52 mutations, and 44 queries. The tools used to build this system are using the PHP 7 programming language and the Lumen f ramework [20]. The database management system (DBMS) used is MariaDB 10.4.6. The web server used to run the competency test information system is Apache 2.4.41 on the local server [21].

Building an API with Graph-QL
In the Graph-QL implementation using the Lumen f ramework and Lighthouse library the architectural pattern used is in Figure 2, which explains the system architecture used in the Graph-QL API. Requests will be accepted by the server and will be checked on Graph-QL Schema [22]. Then the request is continued to the resolver which uses a model to access the database. The results of the requested data will be issued with a JSON data type [22].

Building an API with REST
In the implementation of REST using the Lumen framework the pattern used is in Figure 3. Figure  3 is an architecture in implementing REST on the Lumen framework. Requests will be accepted by the server and f orwarded to Route [21]. The route will be then connected to a Controller that uses a model to access the database. The results of the requested data will be issued with a JSON data type [21].

Test Design of the REST API and Graph-QL
A trial was conducted to find out the functionality of the API with the concept of REST and Graph-QL can run as desired or not. The trial was carried out using the Postman application, which is an application commonly used to make HTTP requests on the server. Tests are carried out on f unctions that have the same data output between REST and Graph-QL [22].

Result and Discussion
The use of an API in an inf ormation system is a bridge between systems built on different platf orms so that the information system has one central server and database storage. Graph-QL was present in 2015, according to the developer Graph-QL is easier to implement in an inf ormation system and can reduce the number of requests on the server and have an impact on reducing network traffic on the server.

Data retrieval using Graph-QL
Bef ore performing data retrieval, the Schema of Graph-QL must f irst define all the attributes of the database tables that are needed as output from requests received. An example of defining a Graph-QL Schema on an object and query is in Figure 4

Retrieving data using REST
Using REST requires a f unction in the controller class that handles requests f rom clients. The f unction code f or retrieving the schema data is shown in Figure 6 (a). Namely a f unction that is used to retrieve 1 schema data according to id. The result of this function is in Figure 6. (b), is the result of REST, the writing format used is the same, JSON. In response time testing is carried out on the process of fetching the schema data that is on the system. Only 25 data are available. From the results depicted in Figure 7, it will be dif ferent f or each p rocess in the system. Figure 2 shows that in terms of speed, REST is f aster than Graph-QL.

Response size comparison results
In comparing the response sizes of the API Implementation with the Graph-QL and REST concepts an experiment was conducted with the same required output goals. The results of testing the REST response size are in Figure 8.
In Figure 10 it is explained that the response size of requests to the API with REST of 563 Bit is taken in 160ms. While the results of the Graph-QL response size test in Figure 9.  In Figure 9 explains that the response size of requests to the API with Graph-QL of 584 Bit reached with 317 ms. these results are greater than the REST response size. But Graph-QL has dynamic properties that can be adjusted to the needs so that if the dat a requirements are less than the data in Figure 9, the response size of Graph-QL is smaller.

Comparisons With Large Data
Another experiment carried out to test the size or speed was to collect 17,329 lines of data with the same code as the process for retrieving schema data in the previous experiment.  Figure 10 shows the results of the data retrieval process with 17,329 rows of independent assessment data on the system using Graph-QL, while Figure 11 shows the data retrieval process using REST. The results of the experiments conducted with 17,329 rows of data in terms of REST speed were superior to Graph-QL with a ratio of 1: 5, but in terms of data size, Graph-QL was lighter than REST due to its effectiveness in data retrieval with Graph-QL.  Figure 12 shows the results of 20 experiments for requests for the process of taking independent assessment data on a system with 17329 rows of data, showing that the request time with REST is f aster than Graph-QL. This is still the same as previous experiments on 25 schema data with REST and Graph-QL.

Conclusion
From the results of the research conducted and explained, REST and Graph-QL can be implemented in the competency test information system. It shows that REST is superior in terms of time and response size if the data needed is the same compared to Graph-QL. However, REST is static, which means that the output results are in accordance with what is written in the function code, it can cause under data fetching or over data fetching. Graph-QL that takes a more dynamic approach, the output results can be modified to reduce the attributes as needed or to retrieve data in the classes that are related to the requested class, which results in, reduced demand from clients. The response size of Graph-QL will accord with the data needed. For this reason, this system is bettered suited if the API is implemented with Graph-QL because each function on the client system will have different data requirements.