The invention discloses a data reading and writing method and system, which includes receiving data reading and writing requests and judging the type of data reading and writing requests. When the data reading and writing requests belong to a predetermined type, the data reading and writing requests are parsed. If the data reading requests belong to the data reading requests, the corresponding data is read from the server, and if the data writing requests belong to the data writing requests, the corresponding data is read from the server. Write the data to the main server for intermediate steps. By using the master server to receive the written data and providing the data to be read from the slave server, the invention can make the servers have different division of labor, avoid the different operation of the two processes of data reading and writing concentrating on the same server, greatly improve the speed and efficiency of the data reading and writing process, reduce the burden of the server, and reduce the network resources needed to occupy. The invention does not need to modify the hardware of the server, and can improve the data reading and writing performance of the server on the basis of the original hardware. The invention is widely applied in the field of information technology.
【技术实现步骤摘要】
一种数据读写方法和系统
本专利技术涉及信息
,尤其是一种数据读写方法和系统。
技术介绍
在信息时代,大量的数据需要读写,数据的读写是任何信息系统运作的重要环节,直接影响信息系统整体的工作。随着移动互联网时代的到来,互联网越来越去中心化,任何人都可以通过互联网向其他人分享大量的数据,这导致服务器读写压力急剧增大,运营商不得不换用硬件性能更好、处理能力更强的服务器,以应对日益增加的数据读写请求,这提高了运营成本,也增加了对资源的消耗。
技术实现思路
为了解决上述技术问题,本专利技术的目在于提供一种数据读写方法和系统。本专利技术所采取的第一技术方案是:一种数据读写方法,包括以下步骤:接收数据读写请求并判断数据读写请求的类型;当数据读写请求属于预先设定的类型时,对数据读写请求进行解析,如果属于数据读取请求,则通过从服务器读取相应的数据,如果属于数据写入请求,则将相应的数据写入主服务器中。进一步地,所述方法还包括以下步骤:当数据读写请求不属于预先设定的类型时,对从服务器进行相应数据的读写或对主服务器进行相应数据的读写。进一步地,所述预先设定的类型是根据数据读写请求的紧急程度、发出频率和/或恶意程度进行划分的。进一步地,所述从服务器的数量为多个,所述主服务器被写入数据后,将新写入的数据同步至所有从服务器中。进一步地,将新写入的数据同步至所有从服务器中之后,删除主服务器中新写入的数据。进一步地,所述通过从服务器读取相应的数据这一步骤,具体包括:检测各从服务器的当前负荷;从当前负荷最低的从服务器中读取相应的数据。进一步地,所述将新写入的数据同步至所有从服务器中这一步骤, ...
【技术保护点】
1.一种数据读写方法,其特征在于,包括以下步骤:接收数据读写请求并判断数据读写请求的类型;当数据读写请求属于预先设定的类型时,对数据读写请求进行解析,如果属于数据读取请求,则通过从服务器读取相应的数据,如果属于数据写入请求,则将相应的数据写入主服务器中。
【技术特征摘要】
1.一种数据读写方法,其特征在于,包括以下步骤:接收数据读写请求并判断数据读写请求的类型;当数据读写请求属于预先设定的类型时,对数据读写请求进行解析,如果属于数据读取请求,则通过从服务器读取相应的数据,如果属于数据写入请求,则将相应的数据写入主服务器中。2.根据权利要求1所述的一种数据读写方法,其特征在于,所述方法还包括以下步骤:当数据读写请求不属于预先设定的类型时,对从服务器进行相应数据的读写或对主服务器进行相应数据的读写。3.根据权利要求1或2所述的一种数据读写方法,其特征在于,所述预先设定的类型是根据数据读写请求的紧急程度、发出频率和/或恶意程度进行划分的。4.根据权利要求1或2所述的一种数据读写方法,其特征在于,所述从服务器的数量为多个,所述主服务器被写入数据后,将新写入的数据同步至所有从服务器中。5.根据权利要求4所述的一种数据读写方法,其特征在于,将新写入的数据同步至所有从服务器中之后,删除主服务器中新写入的数据。6.根据权利要求4所述的一种数据读写方法,其特征在于,所述通过从服务器读取相应的数据这一步...
【专利技术属性】
技术研发人员:刘丰,
申请(专利权)人:无锡天脉聚源传媒科技有限公司,
类型:发明
国别省市:江苏,32
还没有人留言评论。发表了对其他浏览者有用的留言会获得科技券。