登录

  • 登录
  • 忘记密码?点击找回

注册

  • 获取手机验证码 60
  • 注册

找回密码

  • 获取手机验证码60
  • 找回
毕业论文网 > 外文翻译 > 计算机类 > 软件工程 > 正文

Web应用开发中的MySQL和MongoDB混合数据库系统外文翻译资料

 2022-12-19 05:12  

Hybrid Database System of MySQL and MongoDB in Web Application Development

Gregorius Ongo

Computer Science Department,

BINUS Graduate Program - Master of Computer Science Bina Nusantara University

Jakarta, Indonesia 11480 gregorius.ongo@binus.ac.id

Gede Putra Kusuma

Computer Science Department,

BINUS Graduate Program - Master of Computer Science Bina Nusantara University

Jakarta, Indonesia 11480 inegara@binus.edu

Abstract—The increasing amount of data that need to be processed in a company are affecting the performances of the database system. Relational Database Management System (RDBMS) is a commonly used database system, but also known to having a decreased performance when handling high amount of data. NoSQL is an alternative storage option that is different than RDBMS and known for faster performance when handling high amount of data. In this contribution, we compare the performances between RDBMS MySQL and a hybrid model of MySQL and NoSQL MongoDB when being used on a web application. We implemented a simple social media website to evaluate the performance of using different database models. The website is equipped with chat and profile view features. Experiments are performed using randomly generated user profiles and chat data. Based on our evaluations, the hybrid database of MySQL and MongoDB achieves higher read and write performances than the MySQL alone. Meanwhile MySQL can handle more sensitive data and maintaining data consistency. The hybrid model database MySQL and MongoDB uses less disk space than MySQL alone, but uses more RAM. We also observed that there is not much difference in CPU usage for both database models.

Keywords—MySQL, MongoDB, hybrid database, web application, database performance

  1. INTRODUCTION

The usage of a database system is a common thing in development of a system. According to Paradaens et al., a database system is a collection of programs that run on a computer and help the user to collect, change, protect, and manage information [1]. Relational database is widely used in the last 30 years. It is common for a company to use the relational database for the database in their system. The commonly used Relational Database Management System (RDBMS) are MySQL, Oracle, and PostgreSQL. Each RDBMS is well known and have their own superiority. MySQL is known for its faster query execution than the others RDBMS. Even though PostgreSQL have a relatively slower performance than MySQL, PostgreSQL have more features that can help user in managing data. Oracle is usually picked when the user need to handle big and complex data. However, Oracle is more expensive to be implemented than the other databases. On the other hand, MySQL is recorded to be the most used data storage for web applications because of its speed in reading data. The popularity of MySQL is also

supported by its low implementation cost and it is usually free and an open source project.

In 2009, a new method of storing data was introduced, which is called NoSQL (Not Only SQL). The NoSQL is first used in 1998 by Carlo Strozzi. Then, Eric Evans reintroduced the NoSQL in 2009 [2]. The major difference between NoSQL and RDBMS is that the NoSQL does not need a fixed table scheme like RDBMS. There are few types of NoSQL system such as key-value, document, graph, and multi-model [3]. The key-value type stores data as a lsquo;keyrsquo; and a lsquo;valuersquo; for each of the data. The document type stores the data as a lsquo;documentrsquo; where different documents can contain different data within the same collection. The graph type stores data as a lsquo;graphrsquo; that interconnected to each other. Meanwhile, the multi model is a type of NoSQL that uses multiple methods to store data, such as a combination of document and graph. The commonly used NoSQL are MongoDB and Cassandra. MongoDB is one of the NoSQL that uses document system.

Although RDBMS have a good reputation, RDBMS tends to have decreased performance with the increasing data usage in the system. The replication of the relational database can be limited. The relational databases are also made based on consistency rather than availability [4]. NoSQL, on other hand, has a different reputation. It is known to be good at storing high amount of data. The scheme free characteristic of NoSQL made the scalability of the database better. However, these advantages come with sacrifices, such as weaker security or lesser data consistency.

The increasing amount of data that need to be processed in a company are affecting the performances of the database system. Hardware upgrades are also needed to make the system performance back to its expected level [5]. The other effect of the technology advances is big data. The big data is more common to be found in big companies, and managing big data can be a key in competing with other companies [6]. Therefore, we propose a hybrid database system of MySQL and MongoDB to improve the performance of a web application by harnessing the capabilities of the RDMS and NoSQL database models. The ability of the RDBMS in storing sensitive data complements the ability of NoSQL in processing high amount of data. The proposed hybrid database system is implemented using MySQL for relational database and MongoDB for NoSQL.

  1. RELATED WORKS

Hybrid database model is a database system that uses two or more different database models in a system [7]. This model is preferred because sometimes the stored data is not always suitable with the database model being used. Therefore, Cook tried to combine two databases that have different models: object oriented database and relational database [8]. From the experiments, Cook founds some benefits in using multiple database m

剩余内容已隐藏,支付完成后下载完整资料


Web应用开发中的MySQL和MongoDB混合数据库系统

Gregorius Ongo

Computer Science Department,

BINUS Graduate Program - Master of Computer Science Bina Nusantara University

Jakarta, Indonesia 11480 gregorius.ongo@binus.ac.id

摘要:一家公司需要处理的数据量在不断增加,这影响着数据库系统的性能。关系数据库管理系统(RDBMS)是一种常用的数据库系统,但在处理大量数据时,其性能也会下降。NoSQL是一种替代存储选项,与RDBMS不同,在处理大量数据时以更快的性能著称。在本文中,我们比较了RDBMS MySQL和MySQL和NoSQL MongoDB混合模型在Web应用程序上的性能。我们实现了一个简单的社交媒体网站来评估使用不同数据库模型的性能。该网站配有聊天和个人资料视图功能。使用随机生成的用户配置文件和聊天数据进行实验。根据我们的评估,MySQL和MongoDB的混合数据库比单独的MySQL具有更高的读写性能。同时,MySQL可以处理更敏感的数据,保持数据的一致性。混合模型数据库MySQL和MongoDB使用的磁盘空间比MySQL少,但使用的RAM更多。我们还观察到两个数据库模型在CPU使用上没有太大的差异。

关键词:MySQL,MongoDB,混合数据库,Web应用,数据库性能

1 引言

数据库系统的使用是系统开发中的常见问题。Paradaens等人认为,数据库系统是运行在计算机上帮助用户收集、更改、保护和管理信息的程序的集合[1]。关系数据库在过去30年中得到了广泛的应用。对于公司来说,在其系统中使用关系数据库是很常见的。常用的关系数据库管理系统(RDBMS)有MySQL、Oracle和Postgresql。每个RDBMS都是众所周知的,并有自己的优势。MySQL以其比其他RDBMS更快的查询执行速度而闻名。尽管PostgreSQL的性能比MySQL要慢,但是PostgreSQL有更多的功能可以帮助用户管理数据。当用户需要处理大而复杂的数据时,通常会选择Oracle。但是,与其他数据库相比,Oracle的实施成本更高。另一方面,由于MySQL读取数据的速度快,它被记录为Web应用程序最常用的数据存储。MySQL的流行还得益于它的低实现成本,而且它通常是免费的,并且是一个开源项目。

2009年,引入了一种新的数据存储方法,称为NoSQL(Not Only SQL)。NoSQL最早由Carlo Strozzi在1998年使用。然后,EricEvans在2009年重新引入了NoSQL[2]。NoSQL和RDBMS的主要区别在于,NoSQL不需要像RDBMS那样的固定表方案。NoSQL系统有几个类型,如键值、文档、图形和多模型[3]。键值类型将数据存储为每个数据的“key”和“value”。文档类型将数据存储为“文档”,其中不同的文档可以在同一集合中包含不同的数据。图形类型将数据存储为相互连接的“图形”。同时,多模型是一种使用多种方法存储数据的NoSQL类型,如文档和图形的组合。常用的NoSQL是MongoDB和Cassandra。MongoDB是使用文档系统的NoSQL之一。

尽管RDBMS有良好的声誉,但随着系统中数据使用的增加,RDBMS的性能往往会降低。关系数据库的复制是有限的。关系数据库也基于一致性而不是可用性[4]。另一方面,NoSQL有着不同的名声。众所周知,它擅长存储大量数据。NoSQL的无方案特性使数据库具有更好的可扩展性。但是,这些优势也会带来牺牲,例如安全性变差或数据一致性变差。

一家公司需要处理的数据量在不断增加,这影响着数据库系统的性能。硬件升级也需要使系统性能恢复到预期水平[5]。技术进步的另一个影响是大数据。大数据在大公司中更常见,管理大数据是与其他公司竞争的关键[6]。因此,我们提出了一个MySQL和MongoDB的混合数据库系统,通过利用RDMS和NoSQL数据库模型的功能来提高Web应用程序的性能。RDBMS存储敏感数据的能力补充了NoSQL处理大量数据的能力。该混合数据库系统采用关系数据库MySQL和NoSQL MongoDB实现。

2相关研究

混合数据库模型是在一个系统中使用两个或多个不同数据库模型的数据库系统[7]。此模型是首选的,因为有时存储的数据并不总是适合所使用的数据库模型。因此,库克试图将两个具有不同模型的数据库结合起来:面向对象数据库和关系数据库[8]。通过实验,库克发现在一个系统中使用多个数据库模型有一些好处,例如:

bull;灵活性。在复杂的数据类型中,可能需要强制数据适应系统中使用的存储模型。混合数据库模型可以提高系统存储不同类型数据的灵活性。

bull;提高性能。利用多个存储模型的优势可提高系统性能。

bull;逻辑分布。由于混合数据库模型的灵活性,使得数据分布更好,强制数据的数量减少。 bull;为网络构建。提高的性能和存储数据的灵活性可以增强用户使用Web的体验。 混合数据库并不是每个问题的解决方案,但它是创建一个可以存储规范化数据并以良好性能运行聚合查询的数据库的一个选项[9]。例如,电子商务公司可以使用MongoDB存储公司目录,使用MySQL存储交易。从而提高了平台性能,简化了代码库。

3研究方法

在这篇文章中,我们实现了一个简单的社交媒体网站来评估使用不同数据库模型的性能。该网站具有以下功能:用户聊天和个人资料浏览。这个简单的社交媒体网站被选为一个测试案例来展示MySQL的性能,以及MySQL和MongoDB数据库模型在处理结构化和非结构化数据时的混合性能,这在Web应用程序中很常见。

在Windows10操作系统中,使用CodeIgniter框架在PHP中构建了两个相同的网站。还使用了数据库的GUI管理器。Heidisql用于管理MySQ和Robomongo For MongoDB。除了数据库模型外,这两个网站在所有方面都是相同的。第一个网站使用MySQL作为数据库,第二个网站是MySQL和Mongo DB的混合数据库。

图1 MySQL数据库设计

MySQL数据库设计,如图1所示,有四个表:账户表、聊天表、关系表和参考关系表。账户表用于存储账户数据。在我们的实验中,随机创建了1000个用户帐户。帐户ID是帐户表的主键。关系表是存储用户之间关系数据的表,如友元请求、友元和块。账户1id和账户2id将用作索引,以及引用账户表表的账户id的外键。参考关系表将存储关系表中状态的描述。聊天表将存储所有用户聊天数据。聊天id是该表的主键。发送者id和接收者id将用作从账户表引用账户id的外键。

图2混合数据库设计

混合数据库的MySQL设计如图2所示。它类似于图1中仅针对MySQL的系统的MySQL设计。请注意,在混合数据库MySQL中没有聊天表。在混合数据库模型中,聊天数据将存储在MongoDB中。

MongoDB的聊天数据结构包括聊天id、发送者id、接收者id、消息和创建时间。聊天id将数据id存储在MongoDB中。发送者id存储聊天发送者的id,而接收者id将存储聊天接收者的id。消息将存储聊天消息。创建时间将在创建数据时存储Unix时间戳。在这个结构中,id、发送者id和接收者id将用作索引。将图2和图3中的数据合并到MySQL和MongoDB中,形成第二个网站的混合数据库模型。在这项研究中,响应时间数据将收集使用代码点火器基准工具。同时,RAM数据将使用CodeIgniter基准测试工具和ProcessExplorer进行收集。数据库磁盘使用量将使用相应数据库的GUI管理器、MySQL的Heidisql和MongoDB的RoboMongo收集。除了系统性能外,还分析了混合数据库的实现与MySQL的实现相比有多困难。分析包括需要更改多少后端代码,以便系统可以同时使用两个不同的数据库,以及是否有任何库可以支持在用于构建网站的框架上使用数据库。

4实验

A、系统规格

整个实验在硬件上执行,规格如下:

bull;处理器 : Intel i5-3570k 3.4 GHz;

bull;RAM : 8 GB;

bull;输入设备 : 键盘、鼠标;

bull;监视器 : 是;

bull;HDD : 20 GB。

  1. 读写性能比较

我们随机生成网站用户之间的聊天数据进行实验。有三个数据集本实验中使用,在表1中,我们评估了两个不同数据库模型的网站的读写性能。第一个网站使用MySQL数据库,第二个网站使用MySQL和MongoDB的混合数据库。对于每个数据集,收集两个网站的读写响应时间10次。然后通过响应时间的平均值来测量它们的读写性能。

表1 实验的三个聊天数据集

数据集合

大小

第一个数据集

100000

第二个数据集

500000

第三个数据集

1000000

两个数据库模型在不同数据集大小下的平均读取响应时间如表2所示。对于第一个数据集,两个网站之间的读取响应时间没有太大差异。MySQL网站的平均读取响应时间为0.0205秒,使用混合数据库的网站的平均读取响应时间为0.0226秒。它们之间的差别只有0.0021秒,MySQL比MongoDB快一点。

表2 平均读取响应时间

数据库模型

平均读取响应时间

第一次

第二次

第三次

My SQL数据库

0.0205

0.5589

2.2938

混合数据库

0.0226

0.0311

0.0430

响应时间加速

-0.0021

0.5278

2.2508

在第二个数据集中,实验数据由五十万个聊天数据组成。如表2所示,使用MySQL的网站的平均读取响应时间为0.5589秒,使用混合数据库的网站的平均读取响应时间为0.0311秒。与混合数据库读取响应时间相比,MySQL读取响应时间显著增加。与使用MySQL的网站相比,使用混合数据库的网站的读取响应速度提高了0.5278秒。从第一和第二个数据集的结果中,我们还可以看到使用MySQL的网站的平均读取响应时间增加了0.5384。另一方面,使用混合数据库的网站响应时间只增加了0.0085秒。

在第三个数据集上,使用MySQL的网站的平均读取响应时间为2.2938秒,使用混合数据库的网站的平均读取响应时间为0.0430秒。它们的读取响应时间之间的差距现在扩大到2.2508秒。对于较大的数据集大小,两个网站的读取响应时间都较高。然而,与使用混合数据库的网站相比,使用MySQL数据库的网站上的这些增量更为显著。

除了读取响应时间外,还分析了两个网站的写入响应时间。我们测量了在两个网站的现有数据集上插入10个新聊天所需的时间。

网站上现有数据集的大小根据表一中的数据集大小而变化。表3总结了两个数据库模型在不同数据集大小下的平均写入响应时间。

表3平均写入响应时间

数据库模型

平均写入响应时间

第一次

第二次

第三次

My SQL数据库

0.3166

0.4313

0.5500

混合数据库

0.0165

0.0166

0.0310

响应时间加速

0.3001

0.4147

0.5190

如表3所示,在较大的数据集大小上存储新的聊天数据时,平均写入响应时间有所增加。对于使用MySQL数据库的网站,将10个新聊天数据保存

剩余内容已隐藏,支付完成后下载完整资料


资料编号:[19852],资料为PDF文档或Word文档,PDF文档可免费转换为Word

您需要先支付 30元 才能查看全部内容!立即支付

企业微信

Copyright © 2010-2022 毕业论文网 站点地图