ABSTRACT. The method of two-phase locking (2PL) is still used in concurrency access in the global transaction management. It has its advantages in distributed ...
Section Name
SIMULATING TWO-VERSION TWO-PHASE LOCKING OF DISTRIBUTED TRANSACTIONS IN GPSS STUDIO Assoc. Prof. Dr. Svetlana Vasileva1 1
Varna University of Management, Bulgaria
ABSTRACT The method of two-phase locking (2PL) is still used in concurrency access in the global transaction management. It has its advantages in distributed database management systems (DDBMS), conflicted events. The paper views modeling algorithms of Centralized, Distributed and Primary copy Two-version Two-phase locking. The presented algorithms are models of the corresponding variants of the 2PL protocols for DDBMS using two versions. As in concurrency control of distributed transactions in DDBMS deadlocks are possible to appear, one of the ways for their preventing is the usage of two-version architecture of the data in a distributed database (DDB). The lack of algorithms published as well as results from investigations of such algorithms imposes the development of simulation models and their investigation. In detail the paper considers such models of Two-version two-phase locking (2V2PL): Centralized 2V2PL, Primary copy 2V2PL and Distributed 2V2PL. The simulations of the 2V2PL algorithms and the results reported are achieved by the system of imitation modeling GPSS Studio. GPSS Studio is the latest extension (shell) of the GPSS World Imitation Modeling Environment with the following new features: automatic text alignment; contextual hints; general management of the study (models, experiments and results) through a special project structure; Using libraries from pre-created standard composite or elementary blocks; Design of interactive forms for analysis of modeling results; Automatically create a virtual report of the study, etc. The main characteristics of transaction processing in distributed database management systems such as throughput, response time and probability service are presented. Keywords: distributed transactions, distributed database, concurrency control, twoversion two-phase locking, GPSS blocks INTRODUCTION One of the main problems in Distributed database management systems (DDBMS) is concurrency control of transactions. The concurrency control techniques are separated into several types: locking (Two-Phase Locking), timestamp ordering and optimistic [1]. The last two methods longer delays of transactions in the system are in effect when the system is saturated with conflicts. That’s why the Two-phase locking (2PL) model is suitable to be used. But this model has a main drawback of the possibility of deadlocks appearance. Many different methods for locating, resolving and affording the deadlocks exist [1]. Similar models are multi-version algorithms. The using of multi-version architecture arise problems with version storage because the volume of old versions could become bigger than the volume of the current database [2] and [3]. In this Vasileva, S. Simulating Two-Version Two-Phase Locking of Distributed Transactions in GPSS Studio. 18th International Multidisciplinary Scientific GeoConference SGEM 2018, 30 June - 9July, 2018, Vol.18 Informatics, GeoInformatics and remote Sensing Issue 2.1, p. 677-684
18th International Multidisciplinary Scientific GeoConference SGEM 2018
situation, it could be difficult to store these old data. Multi-version protocols have been developed and a limitation of version number is implemented there in order to overcome mentioned problems. A similar Two-version 2PL (2V2PL) protocol is suggested in [3]. The choice of 2V2PL is justified by the proven [4] assertion that in the concurrency control on 2V2PL algorithm for Client / Server system deadlocks are excluded. This evidence is first mathematical, and secondly concerns the implementation of 2V2PL in centralized database management systems. No results from 2V2PL implementation in distributed database management systems, such as most modern Database Management Systems, have been found. This required the development of 2V2PL for DDBMS simulation models: Centralized 2V2PL, Primary Copy 2V2PL and Distributed 2V2PL. These models are developed with the tools of the system for simulation modeling GPSS World [5], [6], etc. The 2V2PL simulation algorithms are described in [7], [8], etc. Imitation modeling systems are constantly evolving and provide more and more effective means of: 1) conducting simulation studies; 2) simulation studies and models should be designed and implemented by specialists in the subject area but not by simulation modeling specialists. Such type of simulation modeling environment is GPSS Studio [9]. Here are some aspects of creating and implementing 2V2PL models in the GPSS Studio. SHORT DESCRIPTION OF 2V2PL SIMULATION MODELS Algorithms for Two-Version two-phase locking for DDBMS are a development of 2PL protocols in Database Management Systems. The enable / denial of blocking is done by the lock manager (LM), which works on the 2V2PL and consistency matrix algorithms described in detail in [3]. In short, if two transactions Ti and Tj want one to read element x and the other to write it and element x is free, both transactions will get the lock on x. it will be shared lock of x, and Tj - exclusive lock of x. The algorithm of processing made by a central lock manager in 2V2PL synthesized and discussed in [7] according to [3] and [10] is given in fig. 1.
Fig. 1: An algorithm for processing of locking requests in the Lock Manager according to 2V2PL
Section Name
Figure 2 schematically shows the algorithm for implementing a distributed transaction in the Primary Copy 2V2PL protocol. This algorithm is similar to the Centralized 2V2PL protocol, except that the Lock table is distributed to the sites where Primary lock managers are. The modeling algorithm is described in [11] in detail. All developed Two-Version 2PL models have the same initial parameters describing the modeled global database and the modeled transactions. The following input data and assumptions for the three models are used according to [7], [8] and [11]:
Number generated flows of transaction – NumTr = 6;
Number of sites in distributed system - NUM = 6. Centralized 2V2PL only has one central node, the central lock manager and central lock table, but no local database [7];
Number of data elements – NumEl = 50;
Number of the data element replicas - 2;
Site copies distribution;
Fig. 2: Scheme of Primary copy 2V2PL
Intensity of each flow - , varying in each model and for each flow;
Generating different transaction flow distribution;
Matrix of distance (time to move) from node to node – for the three models is the same;
When generating GPSS transactions that model global transactions in DDBMS, the following GPSS transaction parameters are set:
Vasileva, S. Simulating Two-Version Two-Phase Locking of Distributed Transactions in GPSS Studio. 18th International Multidisciplinary Scientific GeoConference SGEM 2018, 30 June - 9July, 2018, Vol.18 Informatics, GeoInformatics and remote Sensing Issue 2.1, p. 677-684
18th International Multidisciplinary Scientific GeoConference SGEM 2018
o Transaction length in number processed elements - 2 and less likely 1. The probability of requiring 2 or 1 element is set with the same function for the three models; o A number of the first / second element, "reads" or "updated" by the transaction. Value - a random number evenly spaced within the range [1, NumEl]; o A block type declared for the first / second element. Value: 1 (reading), 2 (updating) or 3 (writing) selected with probabilities given by a specially defined function FN$LockTip1 / FN$LockTip2. MODELING TWO-VERSION TWO-PHASE LOCKING IN GPSS STUDIO The models of 2V2PL algorithms described in [7], [8] and [11] were created and developed by the GPSS World Commercial Version [5], [6], etc. And simulation studies reported in [7], [8] and [11] were made in the middle of GPSS World. The frequency distribution of response time was displayed using the simulation window (Figure 3). Response time and, in particular, its frequency distribution is one of the features by which the algorithms for concurrency control are compared in the simulation studies presented in [7], [8] and [11]. The other 2 important features that have been compared to the 2V2PL simulation algorithms are throughput and probability of service. But if the frequency distribution chart is automatically built by GPSS on a defined queue in the model table, then the cell values NumTr - the total number of transactions generated for the generation of the Throughput and Service Probability diagrams given period, Tn time modeling at different startups of the modeling algorithm and ZavTr - total number of committed transactions and then. In fig. 4 has been demonstrated one of the new features of GPSS Studio: a standard simulation report conducted in GPSS Studio, which was exported in the Spreadsheet Excel. The diagram (figure 4, bottom right) is built on the DaTable table (formed in each standard report generated after a simulation) with the estimated response time of transaction values (Figure 4, top left).
Fig. 3: Frequency distribution of transaction response time in the centralized 2V2PL model at an inrush intensity of 100 transactions per seconds Other new opportunities that make it easier for a researcher are following [9]:
In the process of creating the text of the model: automatic alignment (fig. 5, fig. 6); pointing the syntax of GPSS operators (Figure 5 bottom right - it is shown
Section Name
which function the modeler needs to write, because the key FN $ means the name of function), the contextual hint (fig 6 - the small box at bottom) errors in GPSS operators, etc.;
It is possible to split the window with the text of the model and to work with the text on different parts of the model (fig.5);
General management of the study (models, experiments and simulation results) (Figure 5, Figure 6 and Figure 7 - the left panel);
Fig. 4: Standard Simulation Report exported into MS Excel with built Diagram of frequency distribution of transactions
Fig. 5: Simultaneous operation with different parts of the text of model
Effective and fast tuning of models using the debugger: not only visual tracking of the movement of transactions in the model, but also control of changes in states and values of other model objects. On fig. 7 is shown tracing the modeling algorithm: the yellow line displayed by the executable operator; the number of
Vasileva, S. Simulating Two-Version Two-Phase Locking of Distributed Transactions in GPSS Studio. 18th International Multidisciplinary Scientific GeoConference SGEM 2018, 30 June - 9July, 2018, Vol.18 Informatics, GeoInformatics and remote Sensing Issue 2.1, p. 677-684
18th International Multidisciplinary Scientific GeoConference SGEM 2018
the current transaction is shown in the upper right corner; in the middle to the right the panel for the values of the parameters of the current transaction, in the lower right corner of the screen are shown on the cell values and the possibilities can be opened on the matrices used in the model;
Fig. 6: Using the command „Go to Definition“ and Detailed Reference Manual
Fig. 7: Work on the model in trace mode
Automatic generation of a virtual research report (fig. 8). The report can include the results obtained for all stages of the study. On fig. 8 it is shown the generated standard simulation report from simulation of Centralized 2V2PL. It is shown in fig. 8 the opened window of the matrix LTA [7] modeling the lock table in the central lock manager. A virtual report can be saved in a MS Word or MS Excel file in the Projects folder. On fig. 4 it is shown the generated virtual modeling report as an MS Excel spreadsheet.
Section Name
Fig. 8: Standard report from the simulation of Centralized 2V2PL The much larger number of different ways of visualization of GPSS Studio compared to GPSS World is the ability to achieve a detailed trace of the behavior of transactions and processes in the algorithms during simulation. Thus, for example, for the model of the Centralized 2PL algorithm, the algorithm has been convinced that this algorithm does not allow a deadlock of the transactions. The different modes of visualization of the operation of the modeled system and the windows too, it can be seen how the parallels of the values of the replicas of the data elements Researcher are convinced of the effectiveness of the studied algorithms by observing their performance through the various "screens" of GPSS Studio and saving in a structured type of simulation results together the simulation model in one project. CONCLUSION Conducted simulations and the results confirm functionality of the algorithms simulating Two-version Two-phase locking protocols in Distributed Database Management Systems. The tools of GPSS Studio depicted here for creating systems models using complex algorithms are not all the tools that provide this new environment. In GPSS Studio, most of the operations and actions of the researcher are automatized during the whole cycle of the simulation study. GPSS Studio allows us to reduce the qualification requirements for both the professional simulation model and the end user using the models created by the researcher. In this connection, it is also planned to work on modeling of 2PL and other concurrency control protocols for Distributed Database Management Systems: learning and absorbing the whole technology to conduct simulation research proposed by the creators of GPSS Studio. Thus, the shown technology of preparation of carrying out of experiments radically simplifies carrying out of research with models created by GPSS World, allows to carry out research more deeply and more professionally. Vasileva, S. Simulating Two-Version Two-Phase Locking of Distributed Transactions in GPSS Studio. 18th International Multidisciplinary Scientific GeoConference SGEM 2018, 30 June - 9July, 2018, Vol.18 Informatics, GeoInformatics and remote Sensing Issue 2.1, p. 677-684
18th International Multidisciplinary Scientific GeoConference SGEM 2018
Another aspect of the demonstrated technology is that such simulation models and GPSS Studio's capabilities show the potential for simulation of concurrency control algorithms with an educational purpose.
ACKNOWLEDGEMENT This article is developed within the frame of Project BG05M2OP001-1.002-0008-C01 “Centre for Competence and Intelligent Solutions for the Creative and Recreational Industries (INCREA)”. The project has been funded within Operational Programme “Science and Education for Smart Growth (2014-2020)” and with support from the European Commission. The publication reflects the views only of the authors and the Commission cannot be held responsible for any use which may be made of the information contained therein.
REFERENCES [1] Connolly T., Begg C., Database Systems. Addison – Wesley, 2002, pp 873-974 [2] Bernstein Ph., Goodman Н., Multiversion Concurrency Control – Theory and Algorithms, ACM Transactions on Database Systems, vol. 8, No. 4, 1983, pp 465-483. [3] Chardin P., Data multiversion and transaction http://citforum.ru/database/articles/multiversion, 2005
concurrency
control”.
[4] Kuo T., Kao Y., Kuo C., Two-Version-Based Concurrency Control and Recovery in Real-Time Client/Server Databases, IEEE Transactions on Computers, vol. 52/issue 42, 2003, pp 506-524. [5] General Purpose Simulation www.minutemansoftware.com, 2008.
System
World,
Minuteman
Software,
[6] Tomashevskii V.M., Zhdanova O. G., Simulation modeling in the GPSS environment, Russia, Bestseller, Moscow, 2003. [7] Culciar A., Vasileva, S., Simulation studies of the implementation of Centralized two-phase locking in DDBMS, 29th European Conference on Modelling and Simulation ECMS 2015, May 26th – May 29th, 2015, Bulgaria, pp 107-114. [8] Vasileva S., Milev A., Simulation Studies of Distributed Two-phase Locking in Distributed Database Management Systems. Information Technologies and Control, 1-2 2015, Bulgaria, 2016, pp 46-55. [9] Devyatkov V.V., Devyatkov T. V., Fedotov, M. V., Simulation studies in GPSS STUDIO modeling environment, Russia, INFRA-M, pp 39-68, 2018. [10] Majumdar D., A Quick Survey of MultiVersion Concurrency Algorithms, Journal of Information Science and Engineering 19, November 4, 2007, http://simpledm.googlecode.com/files/mvcc-survey-1.0.pdf. [11] Vasileva S., Simulations of the implementation of primary copy two-phase locking in distributed database systems, COMPUTER MODELLING & NEW TECHNOLOGIES, Latvia, 2015 19(4B), pp 17-23.