CN102724206B - Method and device for accessing Apache server resources - Google Patents

Method and device for accessing Apache server resources Download PDF

Info

Publication number
CN102724206B
CN102724206B CN 201210220297 CN201210220297A CN102724206B CN 102724206 B CN102724206 B CN 102724206B CN 201210220297 CN201210220297 CN 201210220297 CN 201210220297 A CN201210220297 A CN 201210220297A CN 102724206 B CN102724206 B CN 102724206B
Authority
CN
Grant status
Grant
Patent type
Prior art keywords
method
device
accessing
apache
server
Prior art date
Application number
CN 201210220297
Other languages
Chinese (zh)
Other versions
CN102724206A (en )
Inventor
傅飞
Original Assignee
北京搜狐新媒体信息技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Grant date

Links

Abstract

本申请实施例公开了一种Apache服务器资源的访问方法。 Example discloses a method for accessing resources of the present application Apache server. 该方法包括:接收基于Apache连接的访问请求消息,所述Apache连接初始化时设置有与Apache连接对应的配置矢量;判断配置矢量是否为空,如果是,则从资源池Apache服务器提取资源并放入配置矢量中,用于存放处理访问请求的Apache服务器资源的资源池在Apache服务器受到访问之前创建;利用配置矢量中的Apache服务器资源处理完访问请求后将该资源放回所述资源池。 The method comprising: receiving a connection request based access Apache message, provided with Apache arranged with a vector connecting corresponding connection initializing the Apache; determining whether the configuration vector is empty, and if so, extracts from the Apache server resource pool resources and put configuration vector, the Apache server for storing the resource access request processing resource pool created by the Apache server before access; vector using the Apache server configuration processed back to the resource after access to the resource request to the resource pool. 本申请实施例还公开了一种Apache服务器资源的访问装置。 Example embodiments of the present application also discloses a device for accessing the Apache server resources. 本申请实施例提高了Apache服务器资源的访问效率。 Example improve the efficiency of the Apache server to access resources of the application.

Description

—种Apache服务器资源的访问方法及装置 - kind of Apache server resource access method and apparatus

技术领域 FIELD

[0001] 本申请涉及服务器资源访问技术领域,特别是涉及一种Apache服务器资源的访问方法及相应装置。 [0001] The present application relates to a technical field access server resources, and more particularly to a method for accessing the Apache server resource and a corresponding apparatus.

背景技术 Background technique

[0002] Apache服务器是一款功能强大、扩展性好、稳定性强的开源著名WEB服务器,它可运行在几乎所有广泛使用的计算机平台上。 [0002] Apache server is a powerful, scalable, and strong stability famous open source WEB server, it can run on almost any computer platform widely used. 用户通过浏览器访问Apache服务器时,Apache服务器接收到客户端(通过浏览器)发送的访问请求后,根据处理该访问请求需求的Apache服务器资源,创建相应的资源,然后利用该资源完成客户端访问请求的处理,Apache服务器资源使用完毕后释放。 When a user accesses the Apache server through a browser, the Apache server receives a client (browser) after the access request sent, according to Apache server resources of the access request needs to create a corresponding resource, and then use the resources to complete client access processing of requests, Apache server resource release after use. 相同客户端下次访问或其他客户端访问Apache服务器的相同资源时,Apache服务器将重新创建该资源以处理客户端的访问请求。 When the same client to access the same resources Apache server-side next visit or other client, Apache server will re-create the resources to deal with access to the client's request. 然而,Apache服务器的资源创建成本较高,比如mysql连接、memcache连接等,在性能要求严格的环境下,反复多次创建相同的资源,其总的创建成本几乎不可接受,严重影响了Apache服务器资源的访问效率。 However, the Apache server resources to create higher costs, such as mysql connection, memcache connections, etc., under strict environmental performance requirements, repeatedly create the same resources, the creation of its total cost is almost unacceptable, seriously affecting the Apache server resources the access efficiency.

发明内容 SUMMARY

[0003] 为解决上述技术问题,本申请实施例提供一种Apache服务器资源的访问方法及相应的装置,以提高Apache服务器资源的访问效率。 [0003] In order to solve the above problems, the present application provides an Apache server resource access method and corresponding apparatus embodiments, in order to improve access efficiency Apache server resources.

[0004] 本申请实施例提供的Apache服务器资源的访问方法包括: Apache server resources access method according to an embodiment of the [0004] present application comprises:

[0005] 接收基于Apache连接的访问请求消息,所述Apache连接初始化时设置有与Apache连接对应的配置矢量; [0005] Based on the received connection request message to the Apache, provided with Apache configuration corresponding to the vector connecting the connection initialization of the Apache;

[0006] 判断所述Apache连接的配置矢量是否为空,如果是,则从资源池提取Apache服务器资源,并放入配置矢量中;所述资源池在Apache服务器受到访问之前创建,用于存放处理访问请求的Apache服务器资源; [0006] Analyzing the configuration vector Apache connection is empty, and if so, extracts from the Apache server resource pool resources, and placed into a vector; resource pool created before the Apache server being accessed, the processing for storing visit the Apache server resource requests;

[0007] 利用配置矢量中的Apache服务器资源处理完基于Apache连接的访问请求后,将该资源放回所述资源池。 [0007] After processing the access request based on Apache connection, the resources back to the resource pool configuration vector using the Apache server resources.

[0008] 优选地,利用配置矢量中的Apache服务器资源处理完所述访问请求之后,将该资源放回所述资源池之前,将所述Aapche服务器资源在配置矢量中保持第一预设时间阈值长度,以便在该第一预设时间阈值内接收的与基于Apache连接的访问请求消息共用所述Apache连接的其他访问请求使用。 [0008] Preferably, after the use of the configuration vector Apache server resource finished processing the access request, before the resource back to the resource pool, the resource server Aapche holding a first predetermined time threshold in the configuration vector length, so as to receive in the first predetermined time threshold value based on the Apache connection request message to the other access Apache common connection requests.

[0009] 优选地,所述从资源池提取Apache服务器资源具体包括=Apache服务器的获取函数利用互斥锁机制从资源池中提取Apache服务器资源,以确保每次提取的Apache服务器资源各不相同。 [0009] Preferably, the extraction Apache server resource from a resource pool = Apache server comprises acquiring function using a mutex mechanisms Apache server extracting resources from the pool so different each extraction Apache server resources.

[0010] 优选地,所述资源池在Apache服务器受到访问之前创建具体包括: [0010] Preferably, the resource pool created by the Apache server before access comprises:

[0011] Apache服务器的钩子函数注册回调函数; Hook function [0011] Apache server to register a callback function;

[0012] 调用回调函数在Apache服务器受到访问之前创建资源池。 [0012] calls the callback function to create a resource pool before the Apache server is access.

[0013] 优选地,所述资源池创建完成后,所述方法还包括: [0013] Preferably, after the resource pool is created, said method further comprising:

[0014] 读取预设配置文件,利用配置文件包含的参数配置资源池,所述配置文件包含的参数包括资源池满足应用要求的最低资源个数、可容纳的最大资源个数、最大已创建资源个数和/或资源有效期。 [0014] reads preset configuration file, the configuration file using the parameters contained in the resource pool configuration, the configuration file contains the parameters including the minimum number of resources in the resource pool to meet the application requirements, the maximum number of resources that can be accommodated, the maximum has been created The number of resources and / or resource expiration date.

[0015] 优选地,利用配置矢量中的Apache服务器资源处理基于Apache连接的访问请求过程中,所述方法还包括:将所述资源不能被正常使用时的所在时刻记录为资源失效发现时间,则: [0015] Preferably, use of the configuration vector Apache server resources to handle the Apache connection request process based on the method further comprises: recording the time where the resources can not be normally used as a resource discovery failure time, :

[0016]启动资源有效性核查时,获取Apache服务器资源失效发现时间,并判断资源有效性核查启动时刻与Apache服务器资源失效发现时间之差是否大于第二预设时间阈值,如果是,则调用Apache服务器的析构函数将该资源析构出资源池。 [0016] When you start validity verification resources, access to resources Apache server failure discovery time and resources to determine the effectiveness of the verification start time and the Apache server resource fails to find out whether time difference is greater than the second preset time threshold, and if so, call the Apache destructor the server resource a resource pool destructor.

[0017] 进一步优选地,在调用Apache服务器的析构函数将所述资源析构出资源池后,调用Apache服务器的构造函数重新创建所述资源。 [0017] Further preferably, the Apache server calls the destructor after the destruction of the resource pool of resources, call the constructor of the Apache server to re-create the resource.

[0018] 优选地,所述Apache服务器资源包括mysql连接和/或memcache连接。 [0018] Preferably, the Apache server resource comprises mysql connection and / or connection memcache.

[0019] 本申请实施例还提供了一种Apache服务器资源的访问装置。 [0019] The present application further provides an apparatus for accessing resources Apache server. 该装置包括:接收单元、判断单元、移动单元和放回单元,以及在Apache服务器受到访问之前创建的用于存放处理访问请求的Apache服务器资源的资源池,其中: The apparatus comprising: a receiving unit, a determining unit, a mobile unit, and a back unit, and for storing the Apache server resource access request processing resource pool created by the Apache server before access, wherein:

[0020] 所述接收单元,用于接收基于Apache连接的访问请求消息,所述Apache连接初始化时设置有与Apache连接对应的配置矢量; [0020] The receiving unit configured to receive based on the Apache connection request message, the connection is provided with Apache configuration corresponding connection initialization vector when the Apache;

[0021] 所述判断单元,用于判断所述Apache连接的配置矢量是否为空,如果是,则触发移动单元; [0021] The determination unit configured to determine whether the configuration vector of the Apache connection is empty, if yes, trigger the mobile unit;

[0022] 所述移动单元,用于从资源池提取Apache服务器资源并放入配置矢量中; [0022] The mobile unit, for extracting the resource from the Apache server resource pool and placed into a vector;

[0023] 所述放回单元,用于在利用配置矢量中的Apache服务器资源处理完基于Apache连接的访问请求后将该资源放回所述资源池。 [0023] The unit back, Apache server resource utilization in the configuration vector for the processed returned after the resource access request based on Apache connection resource pool.

[0024] 优选地,所述装置还包括保持单元,用于在利用配置矢量中的Apache服务器资源处理完基于Apache连接的访问请求之后,将该资源放回所述资源池之前,将所述Aapche服务器资源在配置矢量中保持第一预设时间阈值长度,以便在该第一预设时间阈值接收的内与基于Apache连接的访问请求共用所述Apache连接的其他访问请求使用。 [0024] Preferably, the apparatus further comprises a holding unit for use in the Apache server resource vector configuration after the access request based on Apache connection, the resources previously processed back to the resource pool, the Aapche holding server resources first predetermined time threshold length in the configuration vector, with other access requests share the Apache connection request based access Apache connected to receive in the first threshold value within a predetermined time.

[0025] 本申请实施例在接收基于Apache连接的访问请求消息后,判断所述Apache连接的配置矢量字段是否为空,如果为空,则从Apache服务器受到访问之前创建的用于存放处理访问请求的Apache服务器资源的资源池中提取Apache服务器资源;在利用配置矢量中的Apache服务器资源处理完所述访问请求后,将该资源放回资源池。 Example [0025] This application is based upon receiving a connection request message to the Apache, the Apache configuration determines whether the connected vector field is empty, the processing for storing the previously created if it is empty, by access from the Apache server access request Apache server resource pool resource extraction Apache server resources; after using the Apache server configuration vector finished processing the access request resource, the resource returned to the resource pool. 与现有技术相比,本申请实施例由于在Apache服务器受到访问之前创建了用于存放Apache服务器资源的资源池,访问端在访问Apache服务器的资源时,如果配置矢量中不存在相应的资源可从资源池中提取资源,而不必在每次访问相同资源时均由Apache服务器重新创建需要资源,从而提高了Apache服务器的资源访问效率。 Compared with the prior art, since the embodiments of the present application created a resource for storing the Apache server resource pool before being Apache server access, access terminal when accessing a resource Apache server, if the configuration vector does not correspond to the presence of the resources extracting resources from the resource pool, without having to re-create the resources needed by the Apache server each time you access the same resources, thereby increasing the efficiency of resource access Apache server.

附图说明 BRIEF DESCRIPTION

[0026]为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请中记载的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。 [0026] In order to more clearly illustrate the technical solutions according to the prior art embodiment of the present application, briefly introduced hereinafter, embodiments are described below in the accompanying drawings or described in the prior art needed to be used in describing the embodiments the drawings are only some embodiments of the present application are described, those of ordinary skill in the art is concerned, without creative efforts, can derive from these drawings other drawings.

[0027] 图1为本申请的一个Apache服务器资源访问方法实施例的流程图; Apache server flowchart of a method for resource access [0027] FIG. 1 embodiment of the present disclosure;

[0028] 图2为本申请的又一个Apache服务器资源访问方法实施例的流程图; Yet a flowchart Apache server resource access method [0028] FIG. 2 embodiment of the present disclosure;

[0029] 图3为本申请的Apache服务器资源访问装置实施例的组成框图。 Example block diagram Apache server resource access apparatus [0029] FIG. 3 embodiment of the present disclosure.

具体实施方式 detailed description

[0030] 为了使本技术领域的人员更好地理解本申请中的技术方案,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。 [0030] In order to make those skilled in the art better understand the technical solution of the present application, in conjunction with the following drawings of the present application example embodiments, the technical solutions in the present application will be clearly and completely described, obviously, the described embodiments are merely part of embodiments of the present application, rather than all embodiments. 基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都应当属于本申请保护的范围。 Based on the embodiments of the present application, all other embodiments to those of ordinary skill in the art without creative efforts shall be made available, should belong to the scope of the present application.

[0031] 参见图1,该图示出了本申请的一个Apache服务器资源的访问方法实施例的流程。 Example flow access method [0031] Referring to Figure 1, which illustrates one application of the present embodiment Apache server resources. 该实施例包括: This embodiment comprises:

[0032] 步骤SlOl:接收基于Apache连接的访问请求消息,所述Apache连接初始化时设置有与Apache连接对应的配置矢量; [0032] Step SlOl: receiving Apache based access connection request message, the connection is provided with Apache configuration corresponding to the connection initialization vector when Apache;

[0033] Apache服务器作为提供服务的网络端,其将不断接收到来自不同客户端(浏览器)的访问请求或者相同客户端的多次访问请求。 [0033] Apache server serving as the network, which will continue to access received from a different client (browser) requests the same or multiple clients access request. 这些访问请求均是基于Apacheconnect1n (Apache连接)的,这里的“connect1n” 一旦建立,则既可以处理单个访问请求,也可以同时处理多个访问请求。 These access requests are based Apacheconnect1n (Apache connection), where "connect1n" Once established, the access request may be a single process, a plurality of access requests can be processed simultaneously. Apache连接通常在初次接收访问请求时在客户端(浏览器)与Apache服务器之间建立,具体建立过程已属于现有技术,这里不再详述。 Apache is typically established connection between the client (browser) and the Apache server receives an access request for the first time, the specific process of establishing already belongs to the prior art, not described in detail here. 在建立Apache连接时,Apache服务器还会初始化一个与该连接对应的资源configurat1nvector (配置矢量),该配置矢量用于存储、汇聚、调用处理基于Apache连接的访问请求的Apache服务器的资源。 Apache when establishing the connection, the Apache server will initiate a connection to the corresponding resource configurat1nvector (configuration vector), which vector is used to store the configuration, aggregation, call processing based on the Apache Apache server connection request resources. 客户端的访问请求消息中除必要的通信要素(比如源地址、目标地址、路由信息等)外,通常还包括需要服务器提供的资源需求,调用满足要求的资源即可实现对该访问请求的处理。 Client access request message communication in addition to the necessary components (such as source address, destination address, routing information, etc.), resource requirements typically require further comprising a server provides, to mobilize resources to meet the requirements of the process can be realized in the access request. 这里的资源包括多种类型,根据不同的标准可进行不同的划分,比如按照功能方式划分,常见的有mysql连接、memcache连接等;按照表现形式划分,可分为基本资源和衍生资源,基本资源是处理访问请求的必需资源,衍生资源是在基本资源基础上进行复合、继承、封装等操作后形成的资源。 Herein include various types of resources, according to different criteria may be differently divided according to functions such as division manner, a common connection mysql, memcache connections; divided according manifestations, it can be divided into basic resources and derived resources, basic resources formed after processing resources required resource access request, the resource is derived on the basis of the composite basic resources, inheritance, encapsulation, and other operations.

[0034] 步骤S102:判断所述Apache连接的配置矢量是否为空,如果是,执行步骤S103,如果否,执行步骤S104 ; [0034] the step S102: determining whether the configuration vector of the Apache connection is empty, if yes, step S103, the if not, to step S104;

[0035] Apache服务器接收到客户端的访问请求后,可通过判断所述访问请求所基于的Apache连接对应的配置矢量是否为空来确定是否需要提取资源。 After [0035] Apache server receives the access request from the client, whether the connection configuration corresponding Apache vector based on the access request to determine whether an empty resource extracted by Analyzing. 如果发出访问请求的客户端是首次访问Apache服务器,则在Apache服务器与客户端(浏览器)之间首次建立Apache连接,这种情况下的Apache连接对应的配置矢量刚被建立,不存在处理访问请求的Apache资源。 If the client issuing the access request is the first visit to the Apache server, Apache is established between the server and the client (browser) connected to the first Apache, Apache connected to the corresponding configuration vector in this case has just been established, the process to access a nonexistent Apache resource request. 如果发出访问请求的客户端非首次访问Apache服务器且与前次访问请求的时间差在一个预设值范围之内,或者,虽然是首次访问,但该访问的客户端与Apache服务器之间已建立Apache连接,且Apache服务器已处理过基于该Apache连接的访问请求,则通常情况下该Apache连接对应的配置矢量不为空。 If you issue a client access request to access the Apache server and not the first time and last time difference in the access request within a preset range, or, although the first visit, but Apache has been established between the access client and Apache server connection, and the Apache server has processed the access request based on the connection Apache, the Apache normally connected to the corresponding empty vector is not configured. 因此,可通过判断配置矢量的情况来获知处理访问请求的资源是否已经存在,从而针对不同情况可采取不同处理措施。 Therefore, to know whether the resource access request process already exists when it is determined by the configuration vector, which can take different treatment measures for different situations.

[0036] 步骤S103:从资源池中提取Apache服务器资源并放入配置矢量中,转入步骤S104 ; [0036] Step S103: extracting from the Apache server resource pool resources and placed into a vector, the process proceeds to step S104;

[0037] 如果访问请求消息的配置矢量字段为空,说明基于Apache连接的配置矢量中没有处理访问请求的资源存在,这种情况下,Apache服务器可从资源池中提取资源,并将该资源放入配置矢量之中,供处理该访问请求使用。 [0037] If the access vector field of the configuration request message is empty, the vector based on the configuration described in connection Apache absence of access request processing resources, in this case, resources can be extracted from the Apache server resource pool, and place the resource in the configuration vector, used for processing the access request. 本申请实施例并不限定从资源池中提取哪一种类型(功能)的资源给客户端的访问请求使用。 Embodiments of the present application is not limited to what type (function) of the extracted resource to the client using the access request from the resource pool. 当然,在实际应用中,可以根据需要对资源池中的资源进行优先排序,按照优先级大小提供资源,也可以对访问请求的需求进行预测,根据预测结果提供资源。 Of course, in practical applications, resources may be needed to prioritize resource pool, the size of resources according to the priority, may be predicted demand access request resources according to the prediction result. 这里的“资源池”是在Apache服务器受到访问之前创建的,用于存放处理访问请求的Apache服务器资源,这些资源通常为可多次使用的“可再生”资源。 Here the "resource pool" is before the Apache server is access created for storing Apache server resources to handle access requests, these resources are usually multi-use "renewable" resource. “Apache服务器受到访问之前”包括Apache服务器访问前的任何时间,比如可以是Apache服务器启动时,也可以是Apache服务器启动后在开启服务功能前创建资源池。 "Before Apache server from accessing" includes any time before the Apache server access, such as when the Apache server can be started, the Apache server can also be started to create a resource pool before opening services.

[0038] 对于资源池的创建方式,根据具体情况的不同,可以包括多种。 [0038] The embodiment for creating a resource pool, depending on the circumstances, may include a plurality. 本实施例提供的一种创建资源池的方法包括:Apache服务器先调用Apache可移植运行库(Apache portableRun-time vlibraries)的钩子函数注册一个回调函数,通过该回调函数创建资源池,资源池创建过程中将向资源池中添加资源。 A method of creating a resource pool provided in the present embodiment comprises: Apache server first hook function call Apache portability library (Apache portableRun-time vlibraries) to register a callback function, create a resource pool, the resource pool creation process by the callback will add resources in the resource pool. 资源池创建完成后可进一步对资源池进行配置。 It may further be configured after the resource pool resource pool is created. 比如,读取预设配置文件,利用配置文件内包含的参数对资源池进行配置,这些参数包括满足应用要求的最低资源个数、可容纳的最大资源个数、最大已创建资源个数、资源有效期等,可以是这些参数中的一种,也可以是几个的组合。 For example, read the default configuration file, the resource pool is configured using the parameters in the configuration file contains the maximum number of resources of these parameters include the minimum number of resources to meet the application requirements can be accommodated, the maximum number of resources have been created, resources validity period, it may be one of these parameters, or may be a combination of several. 通过对资源池进行配置可实现对资源池的定制管理。 Through the resource pool can be configured customized management of resource pools.

[0039] 对于从资源池中提取资源的方式,也包括多种具体实现方式。 [0039] For pattern extracting resources from the resource pool, but also includes various specific implementations. 本实施例提供的一种方式是调用Apache服务器的获取函数(比如,vapr_relist_acquire函数)获取资源。 One way the present embodiment is provided Apache server acquires call function (such as, vapr_relist_acquire function) access to resources.

[0040] 如果访问请求消息的配置矢量字段不为空,说明访问端基于所述Apache连接发起的访问请求不是首次访问请求,配置矢量中已经存在处理访问请求的资源,这种情况下,可直接对配置矢量中的资源加以利用,无需从资源池中提取资源。 [0040] If the configuration vector field of the access request message is not empty, indicating that the access terminal based on the access request is not initiated connection Apache first access request, the resource processing configuration vector access request already exists, In this case, direct to make use of the configuration vector resources, without taking resources from the resource pool.

[0041] 步骤S104:利用配置矢量中的Apache服务器资源处理完所述访问请求后,将该资源放回所述资源池; [0041] Step S104: With the configuration vector Apache server after the resource access request is processed, the resources back to the resource pool;

[0042] 通过从资源池获取使配置矢量具有Aapche服务器资源或者确认配置矢量中先前已存在Apache服务器资源后,即可利用这些资源处理访问请求。 [0042] By obtaining the vector having for the configuration or the configuration server resource Aapche vector previously confirmed Apache server resource already exists from a resource pool, you can use these resources to process access requests. 在完成处理请求的处理后将该资源放置回资源池,这种可以保持资源池内的资源数量的恒定性,以便其他需要利用该相同资源的访问请求使用。 After processing the processing request is placed back into the resource pool resource, this resource can be maintained constant amount of the resource pool, so that other need to use to access the same resource requests.

[0043] 通过上述描述可知,本实施例的技术方案在接收基于Apache连接的访问请求消息后,通过判断所述Apache连接对应的配置矢量的情况决定操作的步骤,配置矢量为空的情况下从资源池中提取资源,并放置到配置矢量中;在确定配置矢量中具有Apache服务器资源后,利用该资源完成访问请求的处理,处理完毕将访问的资源放回资源池。 [0043] apparent from the above description, the technical solution of this embodiment after receiving the connection request based on the Apache message, by determining whether the case of the configuration vector corresponding to the connection Apache decision steps configured vector is empty case from resource pool resource extraction, and placed in the configuration vector; in the configuration vector is determined after having Apache server resources by the resource access request processing is completed, the resource access processed back into the resource pool. 该方案与现有技术相比,本实施例由于在Apache服务器受到访问之前创建了用于存放处理访问请求的Apache服务器资源的资源池,访问端在访问Apache服务器的资源时可Apache连接对应的配置矢量的情况决定从资源池中提取资源,而不必在每次访问相同资源时均由Apache服务器重新创建需要资源,节约了资源创建成本,增加了资源的重复利用率,从而提高了Apache服务器的资源访问效率。 Compared with the prior art embodiment, since the present embodiment creates a resource pool for storing Apache server resources to handle access requests before Apache server being accessed, the access terminal when accessing a resource Apache server may be connected to a corresponding arrangement example Apache vector case decided extract resources from the resource pool, without having each time you access the same resources by the Apache server to re-create the need for resources, the resources to create cost savings, increase the reuse of resources, thereby enhancing the Apache server resources access efficiency.

[0044] 上述实施例的步骤S104中利用的Apache服务器资源,由于资源本身的特性或对资源池内的资源有效期的设定,获得的资源可能已经失效。 Step [0044] S104 of the above embodiment using the Apache server resource, since the resource or set of characteristics of the resource itself is valid resource pool, the resource obtained may be impaired. 如果获得的资源已经失效,一方面无法满足处理访问请求的使用需求,针对该失效的资源可能需要进行资源重新创建以便替换掉该资源;另一方面将浪费资源池的空间,需要从资源池中将这些失效的资源清除。 If the resources available has expired, on the one hand can not meet the needs of processing access requests, resources may need to be resources for the failure to re-create in order to replace the resource; on the other hand will be a waste of space resource pool, from the resource pools these resources will fail to clear. 在资源池的资源可能无效这种情况下,本申请优选对资源的资源有效性进行判断,并根据判断的结果采取相应的措施,由此构成本申请的又一个资源访问方法实施例。 The resource pool resources in this case may be invalid, the validity of the present application is preferably the resource to the resource is judged, and take appropriate action based on result of the determination, a further embodiment whereby the access resource of this application method. 参见图2,该图示出了该实施例的流程。 Referring to Figure 2, which shows a flow of this embodiment. 该实施例包括: This embodiment comprises:

[0045] 步骤S201:接收基于Apache连接的访问请求消息,所述Apache连接初始化时设置有与Apache连接对应的配置矢量; [0045] Step S201: Based on the received connection request message access Apache, provided with Apache connection configuration corresponding to the connection initialization vector when Apache;

[0046] 步骤S202:判断所述Apache连接的配置矢量是否为空,如果是,执行步骤S203,如果否,执行步骤S204 ; [0046] Step S202: determining whether the configuration vector of the Apache connection is empty, if yes, step S203, the if not, to step S204;

[0047] 步骤S203:调用Apache服务器的获取函数从资源池中提取资源,并将提取的资源放入配置矢量中; [0047] Step S203: acquiring the Apache server calling function to extract resources from the resource pool and placed into a vector extracted resources;

[0048] 步骤S204:利用配置矢量中的Apache服务器资源处理所述访问请求; [0048] Step S204: With the configuration vector Apache server resources to handle the access request;

[0049] 步骤S205:监控Apache服务器资源是否能够正常使用,如果是,则执行步骤S207 ;如果否,则执行步骤S206 ; [0049] Step S205: Apache server resource monitor whether the normal use, if yes, performing step S207; if not, proceed to step S206;

[0050] 步骤S206:将不能使用时的所在时刻记录为所述Apache服务器资源的失效发现时间; [0050] Step S206: the not used when the time where the failure is recorded as the Apache server resource discovery time;

[0051] 本实施例对Apache服务器资源是否失效的判断采取被动式机制,即通过利用Apache服务器资源处理访问请求的执行过程的情况来判断,如果该资源在执行处理访问请求过程中不能正常操作,则认为该资源已经失效,但该资源失效的真正时间可能早于当前时间,这里将当前时间记录为Apache资源失效的发现时间;如果该资源在执行处理访问请求中能够正常执行,没有出现问题,说明该资源仍然有效,可以继续放回资源池再次利用。 [0051] The present embodiment adopted a passive mechanism for determining whether the Apache server failed resource, i.e. be determined by using a case of performing the process of Apache resource processing access request server, if the resource can not operate normally performs a process access request process, the believes that the resource has failed, but the resource failed real time may be earlier than the current time, where the current time is recorded as Apache resource failure discovery time; if the resource is able to perform normal execution process access requests, no problems, indicating the resource is still valid, you can continue back into the resource pool for reuse. 除上述这种被动式判断资源失效与否的方式外,还可以采取主动式机制,即通过额外的专门程序对资源池内的Apache资源进行逐一检查,如果资源在资源池中存留的时间(闲置时间)超过了资源有效时间,则认为该资源失效,这时将检查到资源失效的当前时间记录为该资源的失效发现时间。 In addition to the above-described embodiment such a passive failure is determined whether or not the resource can also take the proactive mechanism, i.e. checked one by one by the resource pool resources Apache additional special procedures, if the resource pool resource retention time (idle time) more than the effective time resource, the resource is considered to fail, then fail to check the resource records for the failure of the current time resource discovery time. 被发现已经失效的资源,在大多数情况下,并不立即进行销毁,或者销毁后立即重新建立该资源,而是否采取上述措施以及何时采取上述措施需要根据后续的资源清理操作决定。 Was discovered resources have failed, in most cases, is not immediately destroyed or re-established immediately after the destruction of the resource, and whether to take such measures and when to take such measures need to decide according to the subsequent cleanup of resources.

[0052] 步骤S207:访问请求处理完毕后将Apache服务器资源放回资源池; [0052] Step S207: after the access request is processed Apache server resources back into the resource pool;

[0053] 本实施例中“资源回置”操作可通过回调函数实现,具体而言,将资源池中的Apache服务器资源添加到配置矢量时先注册一个对应的回调函数,在需要将使用完毕的Apache服务器资源回置到资源池时调用该回调函数执行回置功能。 [0053] In the present embodiment, "resource set back" operations may be implemented by the callback function, specifically, adding Apache server resource to the resource pool configuration vector register corresponding to a callback function in need after use Apache server resources back home to call the callback function when execution is set back to the resource pool.

[0054] 步骤S208:启动资源有效性核查时,获取Apache资源失效发现时间,判断资源有效性检查启动时刻与Apache服务器资源失效发现时间之差是否大于第二预设时间阈值,如果是,则执行步骤S209 ;如果否,则结束流程; [0054] Step S208: When starting the validity verification resources, acquisition resources fail Apache discovery time, determining resource availability check start time and the Apache server resources fail to find out whether a second predetermined time difference is greater than the time threshold, if yes, execute step S209; if NO, the process ends;

[0055] 如前所述,Apache服务器资源即便被发现为失效资源,并记录下该资源失效的发现时间,但该资源并不必然或者立即进行销毁,而需要本步骤的资源有效性核查工作。 [0055] As described above, Apache server resources even if they are found to be invalid resource, and record the failed resource discovery time, but the resources are not necessarily performed immediately destroyed or, resource availability verification required in this step. 本实施例的资源有效性核查的启动时间可根据实际情况决定,可以选择再次从资源池中提取Apache服务器资源放入配置矢量后,利用该资源处理访问请求之前进行资源有效性检查,这样一旦发现提取的资源已经失效,则可从资源池中重新提取供处理访问请求的资源,而无需等到利用该资源处理访问请求过程中才发现资源已经失效,从而节约访问请求的处理效率;也可以选择Apache服务器没有处理访问请求的空闲时段内,对资源池的资源进行有效性检查,这样可减少Apache服务器的工作负荷,均勻分布Apache服务器的运算处理能力。 This start time validity verification resources embodiments may be determined according to the actual situation, it can be selected again after extraction from the Apache server resources into the resource pool configuration vector, prior to processing using the resource access request checking the validity of resources, so if it is found resource extraction has failed, can be re-extracted from the resource pool resources for processing access requests, without waiting for the process using the resource access request is found during resource has failed, thereby saving the processing efficiency of the access request; can also choose Apache the server does not process the access request idle period, the resource checking the validity of the resource pool, which can reduce the load Apache server, uniformly distributed processing power of the Apache server. 此外,对资源池内的资源进行有效性核查的工作可以按照预设时间间隔周期性自动进行,也可以在接收、处理访问请求等过程中实时地进行,无论哪种方式,均可实现本申请实施例的发明目的。 In addition, resources in the resource pool validity verification work can be automatically performed periodically according to a preset interval of time, may be received, the access request process and other processes in real time, either way, application of the present embodiment can achieve purposes of the invention. 这里的第二预设时间阈值可根据Apache服务器的工作负荷、资源有效性的历史数据等实际情况选择。 Where the second predetermined time threshold value can be selected according to the actual workload of the Apache server, the validity of historical data resources.

[0056] 步骤S209:调用Apache服务器的析构函数将该资源析构出资源池,并调用Apache服务器的构造函数重新创建所述资源,结束流程。 [0056] Step S209: Apache server calls the destructor destructor a resource pool of resources, and calling the constructor recreate the Apache server resources, the process ends. 重新创建的资源仍然放置于资源池之中,用于替换所述失效的资源。 Re-create the resource is still being placed in the resource pool for the replacement of the failed resource.

[0057] 通过上述描述可知,本实施例的资源池的自我修复过程由两个工作协调完成:一是对资源是否失效的发现过程;二是对资源是否需要析构重建的清理核查过程,前一过程是后一过程的前提,没有对资源失效与否的发现登记,便不能进行资源析构重建的清理管理。 [0057] apparent from the above description, a resource pool of self-repair process embodiment of the present embodiment is completed by the two coordination: First, the resource discovery procedure is failed; the second is whether the resource requires destruction reconstructed cleaning verification process, prior to a process is a prerequisite for the latter process, there is no resource discovery failed or not registered, it can not be rebuilt destructor cleanup resources management. 基于此,本实施例使得资源在利用过程中自动发现失效有效情况,并主动进行自我修复,这种灵活、动态的资源池机制可充分满足访问端的各种需求。 Based on this, the present embodiment enables automatic discovery of resource utilization in the case of effective failure process, and proactive repair itself, this flexible, dynamic resource pooling fully meet the various needs of the access terminal. 实际上,除上述这种资源池的自我管理外,还可以采取其他措施实现管理,比如通过创建单独管理线程实现资源的管理。 In fact, in addition to the above-mentioned self-management of this resource pool, you can also take other measures to achieve the management, such as management of resources to achieve management by creating a separate thread.

[0058] 上述两个实施例中调用Apache服务器的获取函数从资源池中提取资源时,本申请并未限定具体获取资源的方式,获取函数可以从资源池中获取一个资源,也可以获取多个资源提供给访问请求使用;也没有限定资源池的资源与Apache工作线程的关系,他们可以具有等同的数量,也可以不具有等同的数量。 [0058] The two embodiments of the Apache server calls the function acquired from the resource pool embodiments resource extraction, the present application is not limited to the specific embodiment of access to resources, obtaining function to obtain a resource from the resource pool, the plurality may be acquired using the resources available to access requests; there is no defined relationship between resources and Apache worker thread pool of resources, they can have a number of equivalent, you may not have an equivalent amount. 但是,在实际应用中,为了进一步提高资源访问的效率,防止在资源提取或获取过程中的资源发生争抢现象,本申请优选采取两种措施:一是采用互斥锁机制。 However, in practical application, in order to further improve the efficiency of access to resources, prevent resource in the resource extraction or acquisition process of fighting the phenomenon occurs, the application is preferable to take two measures: First, the use mutex lock mechanism. 互斥锁通过在访问资源池时对资源池进行锁定,从而确保在每次提取资源池的资源时其他访问请求不能进行资源提取,且每次提取的资源各不相同,防止资源提取错误、混淆、争抢等现象出现。 Mutex by resource pool when accessing the resource pool is locked, ensuring that when resources are extracted every resource pool of resources to other access requests can not be extracted, and each extraction of resources vary, prevent resource extraction errors, confusion , competition and other phenomena. 二是默认Apache工作线程与资源池内资源数量相同,这样可以保证每个工作线程都有属于自己的资源对象,避免争抢资源导致性能损耗。 Second, the default Apache work the same number of threads and resource pool of resources, so you can ensure that each worker thread has its own resource object to avoid competition for resources result in performance loss.

[0059] 上述两个实施例中的步骤S104、S206,在利用配置矢量的Apache服务器资源处理完毕访问请求后,可立即将Apache服务器资源放回资源池,以便基于其他Apache连接的访问请求使用。 [0059] The steps of the above two embodiments of S104, S206, with the configuration vector in the Apache server resource access request is processed, the Apache server resources can be immediately returned to the resource pool, so as to request another Apache-based access connection. 但是,在实际应用中,基于概率统计理论可知,在客户端(浏览器)与Apache服务器之间建立好Apache连接后,基于该连接的访问请求通常还在一段时间内连续存在,如果在前一个访问请求处理完后即将配置矢量中的Apache服务器资源放回资源池,那么在紧接着的基于该同样的Apache连接的下一个访问请求将需要从资源池中重新获取Apache服务器资源,这将增加操作时间,降低资源的访问效率。 However, in practical applications, based on the theory of probability and statistics shows that the Apache establish good connection between the client (browser) and the Apache server, based on the access request for the connection is often still exist within a continuous period of time, if the previous after the request is about to access configuration vector back Apache server resource pool resource, then the server will need to obtain resources from the resource pool Apache immediately to the next access request based on the same connection Apache, which will increase the operating time, reducing the efficiency of resource access. 为此,本申请优选在利用配置矢量中的Apache服务器资源处理完所述访问请求之后,将该资源放回所述资源池之前,将所述Aapche服务器资源在配置矢量中保持第一预设时间阈值长度。 To this end, the present application preferably Apache server resource configuration using vectors processed after the access request, before the resource back to the resource pool, the resource server Aapche holding a first configuration vector in a predetermined time threshold length. 通过这种方式,在该第一预设时间阈值内基于同样的Apache连接的其他访问请求到来时,便不需到资源池去提取Apache资源,而可直接利用处理前次访问请求时保持在该连接对应的配置矢量中的资源,从而提高了资源访问效率。 When held in this manner that, within the first predetermined time threshold Apache other access the same connection request arrives based, it does not need to extract the resource pool resources Apache, but may directly previous processing access requests vector corresponding to a connection configuration resources, thereby increasing the efficiency of resource access. 这里的第一预设时间阈值可根据Apache服务器接收访问请求的实际情况决定,比如,在大多数情况下,5分钟内接收的访问请求较多,5分钟后接收的访问请求较少,则该预设时间阈值可设定为5分钟。 Situation where a first predetermined time threshold may receive the access request under the Apache server determines, for example, in most cases, the received access request within 5 minutes more, less five minutes after receiving the access request, the preset time threshold may be set to 5 minutes.

[0060] 以上内容详细描述了本申请的方法实施例,相应地,本申请还提供了一种基于Apache服务器的资源访问装置。 Example [0060] The foregoing detailed description of the method of the present disclosure, accordingly, the present application also provides a resource access device based on the Apache server.

[0061] 参见图3,该图示出了本申请资源访问装置实施例的结构示意图。 [0061] Referring to Figure 3, which shows the apparatus of the present application to access the resource schematic structural diagram of the embodiment. 该装置实施例包括:接收单元301、判断单元302、移动单元303和放回单元304,以及在Apache服务器受到访问之前创建的用于存放Apache服务器资源的资源池305,其中: Example The apparatus comprises: a receiving unit 301, determining unit 302, the mobile unit 303 and the back section 304, and resource pools for storing Apache server resources created by the Apache server before access 305, wherein:

[0062] 接收单元301,用于接收基于Apache连接的访问请求消息,所述Apache连接初始化时设置有与Apache连接对应的配置矢量; [0062] The receiving unit 301 is configured to receive based on the Apache connection request message, the connection is provided with Apache configuration corresponding connection initialization vector when the Apache;

[0063] 判断单元302,用于判断所述Apache连接的配置矢量是否为空,如果是,则触发移动单元; [0063] determination unit 302 for determining whether the configuration vector of the Apache connection is empty, if yes, trigger the mobile unit;

[0064] 移动单元303,用于从资源池提取Apache服务器资源并放入配置矢量中; [0064] The moving unit 303, the Apache server for extracting resources from the resource pool and placed into a vector;

[0065] 放回单元304,用于在利用配置矢量中的Apache服务器资源处理完所述访问请求后将该资源放回所述资源池。 [0065] back into the unit 304, Apache server resource utilization in the configuration vector for the processed returned to the resource pool of resources after the access request.

[0066] 该装置实施例的工作过程是:接收单元接收基于Apache连接的访问请求消息,由判断单元302判断Apache连接初始化时设置的与其对应的的配置矢量是否为空,如果是,则触发移动单元303,由移动单元303从资源池中提取Apache服务器资源并放入配置矢量中;在利用Apache服务器资源处理完访问请求后由放回单元304将该放回所述资源池。 Operation of this embodiment of [0066] the device is: a receiving unit receiving a request message based on the Apache connection is set when the determining unit 302 determines Apache connection initiation corresponding configuration vector is null, and if yes, trigger the mobile unit 303, extracted by the mobile unit 303 from the Apache server resource pool resources and placed into a vector; in the use of Apache server resource access request processed by the unit 304 back into the back of the resource pool.

[0067] 本装置实施例在接收基于Apache连接的访问请求消息后,判断Apache连接对应的配置矢量是否为空,如果为空,则从资源池中提取资源并放入配置矢量中;在利用所述资源处理完访问请求后将该资源放回资源池。 [0067] In the present embodiment, after receiving apparatus based on the connection request access message Apache, Apache determines whether the connection configuration corresponding to empty vector, if empty, to extract resources from the resource pool and placed into a vector; in the use of the after processing said resource access request resources back into the resource pool. 与现有技术相比,本装置实施例由于在Apache服务器受到访问之前创建了用于存放Apache服务器的资源的资源池,访问端在访问Apache服务器资源时可从资源池中提取资源,而不必在每次访问相同资源时均由Apache服务器重新创建需要资源,从而提高了Apache服务器的资源访问效率。 Compared with the prior art, since the present embodiment means creates a resource pool of resources for storing the Apache server before access by the Apache server, the access terminal may extract resources from the pool when the Apache server resources, without having to re-create the required resources at each access the same resources by the Apache server, thereby increasing the efficiency of resource access Apache server.

[0068] 上述装置实施例中还可以包括保持单元,用于在利用配置矢量中的Apache服务器资源处理完所述访问请求之后,将该资源放回所述资源池之前,将所述Aapche服务器资源在配置矢量中保持第一预设时间阈值长度,以便在该第一预设时间阈值内与所述访问请求消息共用所述Apache连接的其他访问请求使用。 Embodiment may further include holding means for utilizing the configuration after the Apache server resource vector finished processing the access request, the resource back into the resource pool before, the resource server Aapche [0068] The above-described apparatus embodiment holding the first threshold length of time preset in the configuration vector, the access request message to the common with other access requests using the Apache connection within the first predetermined time threshold. 这样,可增强资源使用的便捷性,提高了资源访问的整体效率。 In this way, it can enhance the ease of use of resources and improve the overall efficiency of resource access.

[0069] 上述装置实施例中的获取单元调用Apache服务器的获取函数从资源池中提取资源时可采取互斥锁机制,以确保每次提取的资源各不相同,这样可以避免资源提取错误、混淆、争抢等现象的出现。 [0069] The above-described apparatus embodiment acquiring unit acquires the Apache server function calls embodiments may take the mutex mechanism when extracting resources from the pool, to ensure that the resources are not the same each extraction, the extracted resources to avoid errors, confusion emergence of competition and so on. 为防止这种资源争抢问题,还可以对资源池进行配置,通过接收配置参数对资源池的可容纳的最大资源个数、满足应用需求的最低资源个数、资源的有效期,以及资源池内已经创建的资源个数与Apache工作线程数之间的关系等。 To prevent this problem of competition for resources, you can also configure resource pools, by receiving the configuration parameters for the maximum number of resources in the resource pool that can be accommodated, the minimum number of resources to meet the application requirements of the valid resources, and resource pool has create a relationship between the number of resources and the number of Apache worker threads and so on. 通过这些配置可进行资源池的定制,从而提高资源访问效率、减少资源争抢和冲突。 These configurations can be customized through the resource pool, thereby increasing the efficiency of resource access, reduce resource competition and conflict. 比如,如果资源池内已创建的资源个数与Apache工作线程数相等,可保证每个工作线程使用自己的资源对象,避免争抢资源导致性能损耗。 For example, if the thread count the number of resources in the resource pool has been created with the Apache equal work, guarantees that each worker thread uses its own resource object to avoid competition for resources result in performance loss.

[0070] 需要进一步说明的是,前述的几个实施例提到了资源和资源池等概念,为了简洁起见,在使用这些概念时采用多种类似的叫法,比如Apache服务器资源、处理访问请求的Apache服务器资源、Apache资源、重复可利用资源、资源等,但本领域普通技术人员知道,在本申请所在技术领域的语境下,这些不同的词语在本质上具有等同的含义,应当作相同或类似的理解。 [0070] It is further noted that the foregoing several embodiments referred to the concept of resources and resource pool, for brevity, it is called using a variety of similar when using these concepts, such as the Apache server resources, processing of access requests Apache server resources, Apache resources, available resources repeated, resources, those of ordinary skill in the art know, in the context of the art where the present application, these terms have different meanings equivalent in nature, should be the same as or a similar understanding. 对于资源池的概念,其功能在于放置处理访问请求的Apache资源,这些处于资源池中的资源根据实际情况的不同,具有多种具体组织形式,比较常见的比如采用Apache服务器的reslist进行资源组织,reslist本质上是一个数据结构链表,是APR提供的一个工具,该工具具有如下功能:(I)可指定reslist中管理的资源的数量限制,比如前述的最小资源个数、最大资源个数、最大已创建资源个数等等;(2)提供资源的构造函数(constructor)和析构函数(deconstructor),前者用于重建资源池中的资源,后者用于将资源从资源池中销毁;(3)从reslist中得到资源项的读取超时设置等功能。 For the concept of the resource pool, the resource whose function is placed Apache process access request, the resources in the resource pool depending on the actual situation, a variety of specific forms of organization, such as the use of more common reslist Apache server resource organization, reslist is essentially a data structure on the list, APR is provided a tool, the tool has a function: quantity (I) can be specified reslist managing resources, such as the minimum number of resources, the maximum number of resources, the maximum the number of resource has been created and the like; (2) providing a resource constructor (constructor) and destructor (Deconstructor), the former for the reconstruction of a resource pool of resources, which is used to destroy the resource from the resource pool; ( 3) to give the read-out resource items from the functions provided in reslist. 利用Apache服务器的reslist提供的诸如上述的各种功能,可实现对资源池的数据(资源)的管理。 Apache server using various functions such as described above reslist provided, enables the management of data (resource) resource pool.

[0071] 为了描述的方便,描述以上装置时以功能分为各种单元分别描述。 [0071] For convenience of description, the description of the above device is divided into various functional units are described. 当然,在实施本申请时可以把各单元的功能在同一个或多个软件和/或硬件中实现。 Of course, the function of each unit is implemented in one or more software and / or hardware at the time of application of the present embodiment.

[0072] 通过以上的实施方式的描述可知,本领域的技术人员可以清楚地了解到本申请可借助软件加必需的通用硬件平台的方式来实现。 [0072] By the above described embodiments can be seen, those skilled in the art can understand that the present application may be implemented by software plus a necessary universal hardware platform. 基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品可以存储在存储介质中,如R0M/RAM、磁碟、光盘等,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例或者实施例的某些部分所述的方法。 Based on such understanding, the technical solutions of the present application or the nature of the part contributing to the prior art may be embodied in a software product, which computer software product may be stored in a storage medium, such as a R0M / RAM, magnetic disk, , an optical disc, and includes several instructions that enable a computer device (may be a personal computer, a server, or network device) method for each application of the present embodiment or embodiments certain portions of the described embodiment is performed.

[0073] 本说明书中的各个实施例均采用递进的方式描述,各个实施例之间相同相似的部分互相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。 [0073] In the present specification, various embodiments are described in a progressive manner, similar portions of the same between the various embodiments refer to each other, are different from the embodiment and the other embodiments described each embodiment focus. 尤其,对于系统实施例而言,由于其基本相似于方法实施例,所以描述得比较简单,相关之处参见方法实施例的部分说明即可。 In particular, for embodiments of the system, since they are substantially similar to the method embodiments, the description is relatively simple, some embodiments of the methods see relevant point can be described. 以上所描述的系统实施例仅仅是示意性的,其中所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。 Embodiments of the systems described above are merely exemplary, as a unit wherein the separate parts may be or may not be physically separate, parts displayed as units may be or may not be physical units, i.e. may be located a place, or they may be distributed to multiple network units. 可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。 You can select some or all of the modules according to actual needs to achieve the object of the solutions of the embodiments. 本领域普通技术人员在不付出创造性劳动的情况下,即可以理解并实施。 Those of ordinary skill in the art without creative efforts, can be understood and implemented.

[0074] 本申请可用于众多通用或专用的计算系统环境或配置中。 [0074] The present application can be used in numerous general purpose or special purpose computing system environments or configurations. 例如:个人计算机、服务器计算机、手持设备或便携式设备、平板型设备、多处理器系统、基于微处理器的系统、置顶盒、可编程的消费电子设备、网络PC、小型计算机、大型计算机、包括以上任何系统或设备的分布式计算环境等等。 For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PC, minicomputers, mainframe computers, comprising any of the above systems or devices, the distributed computing environment.

[0075] 本申请可以在由计算机执行的计算机可执行指令的一般上下文中描述,例如程序模块。 [0075] The present application may be described in the general context of computer-executable instructions, executed by a computer, such as program modules. 一般地,程序模块包括执行特定任务或实现特定抽象数据类型的例程、程序、对象、组件、数据结构等等。 Generally, program modules include performing particular tasks or implement particular abstract data types routines, programs, objects, components, data structures, and the like. 也可以在分布式计算环境中实践本申请,在这些分布式计算环境中,由通过通信网络而被连接的远程处理设备来执行任务。 This application may be practiced in a distributed computing environment, the distributed computing environments, where tasks are performed by remote processing devices that are linked through a communications network. 在分布式计算环境中,程序模块可以位于包括存储设备在内的本地和远程计算机存储介质中。 In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices in.

[0076] 以上所述仅是本申请的具体实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本申请原理的前提下,还可以做出若干改进和润饰,这些改进和润饰也应视为本申请的保护范围。 [0076] The above are only specific embodiments of the present disclosure, it should be noted that those of ordinary skill in the art, in the present application without departing from the principles of the premise, can make various improvements and modifications, such modifications and modifications should be considered within the scope of the present application.

Claims (10)

  1. 1.一种Apache服务器资源的访问方法,其特征在于,该方法包括: 接收基于Apache连接的访问请求消息,所述Apache连接初始化时设置有与Apache连接对应的配置矢量; 判断所述Apache连接的配置矢量是否为空,如果是,则从资源池提取Apache服务器资源并放入配置矢量中;所述资源池在Apache服务器受到访问之前创建,用于存放处理访问请求的Apache服务器资源; 利用配置矢量中的Apache服务器资源处理完基于Apache连接的访问请求后将该资源放回所述资源池。 1. An access method for the Apache server resources, wherein, the method comprising: receiving a connection request based access Apache message, provided with Apache connection configuration corresponding to the initialization vector Apache connection; determining whether the connection Apache empty vector is configured to, if so, extracts from the Apache server resource a resource pool and placed into a vector; the Apache server resource pool prior to access by creating, for storing the Apache server resources to handle access requests; vector using the configuration the Apache server resources after processing the Apache connection request based on the resource back to the resource pool.
  2. 2.根据权利要求1所述的方法,其特征在于,利用配置矢量中的Apache服务器资源处理完所述访问请求之后,将该资源放回所述资源池之前,将所述Aapche服务器资源在配置矢量中保持第一预设时间阈值长度,以便在该第一预设时间阈值内接收的与基于Apache连接的访问请求消息共用所述Apache连接的其他访问请求使用。 After 2. The method according to claim 1, wherein, with the configuration vector in the Apache server resource access request has been processed, back into the resource pool prior to said resource, the resource configuration server Aapche holding the first predetermined threshold time length vector, in order to receive the first threshold and the predetermined time based on the Apache connection request message to the other access Apache common connection requests.
  3. 3.根据权利要求1所述的方法,其特征在于,所述从资源池提取Apache服务器资源具体包括: Apache服务器的获取函数利用互斥锁机制从资源池提取Apache服务器资源,以确保每次提取的Apache服务器资源各不相同。 3. The method according to claim 1, wherein the extraction Apache server resource from a resource pool comprises: Apache server acquires function extracted using the mutex mechanisms Apache server resource from a resource pool to ensure that each extraction Apache server resources vary.
  4. 4.根据权利要求1所述的方法,其特征在于,所述资源池在Apache服务器受到访问之前创建具体包括: Apache服务器的钩子函数注册回调函数; 调用回调函数在Apache服务器受到访问之前创建资源池。 4. The method according to claim 1, wherein said resource pool comprises created by Apache server before access: hook function Apache server callback function is registered; callback function is called to create a resource pool by Apache server before access .
  5. 5.根据权利要求1所述的方法,其特征在于,所述资源池创建完成后,所述方法还包括: 读取预设配置文件,利用配置文件包含的参数配置资源池,所述配置文件包含的参数包括资源池满足应用要求的最低资源个数、可容纳的最大资源个数、最大已创建资源个数和/或资源有效期。 The method according to claim 1, wherein after the resource pool is created, said method further comprising: reading the preset configuration file, the configuration file using the parameter included in a resource pool configuration, the configuration file including the minimum number of parameters contained in the resource pool of resources to meet the application requirements, the maximum number of resources that can be accommodated, the maximum number of resources have been created and / or resource expiration date.
  6. 6.根据权利要求5所述的方法,其特征在于,所述方法还包括:利用配置矢量中的Apache服务器资源处理基于Apache连接的访问请求过程中,将所述资源不能被正常使用时的所在时刻记录为资源失效发现时间,则: 启动资源有效性核查时,获取Apache服务器资源失效发现时间,并判断资源有效性核查启动时刻与Apache服务器资源失效发现时间之差是否大于第二预设时间阈值,如果是,则调用Apache服务器的析构函数将该资源析构出资源池。 6. The method according to claim 5, characterized in that the method further comprises: processing with Apache server resource configuration vector based upon where the Apache connection request process, the resources can not be used normally time record for the resource failure discovery time, then: when you start to verify the validity of resources, access to resources Apache server failure discovery time and resources to determine the effectiveness of the verification start time and the Apache server resource fails to find out whether time difference is greater than the second preset time threshold If so, the Apache server calls the destructor destructor a resource pool resources.
  7. 7.根据权利要求6所述的方法,其特征在于,在调用Apache服务器的析构函数将资源析构出资源池后,调用Apache服务器的构造函数重新创建所述资源。 7. The method according to claim 6, characterized in that, after calling the destructor Apache server resource a resource pool destructor, calling the constructor recreate the Apache server resource.
  8. 8.根据权利要求1所述的方法,其特征在于,所述Apache服务器资源包括mysql连接和/或memcache连接。 8. The method according to claim 1, wherein said resource comprises mysql Apache server connection and / or connection memcache.
  9. 9.一种Apache服务器资源的访问装置,其特征在于,该装置包括:接收单元、判断单元、移动单元和放回单元,以及在Apache服务器受到访问之前创建的用于存放处理访问请求的Apache服务器资源的资源池,其中: 所述接收单元,用于接收基于Apache连接的访问请求消息,所述Apache连接初始化时设置有与Apache连接对应的配置矢量; 所述判断单元,用于判断所述Apache连接的配置矢量是否为空,如果是,则触发移动单元; 所述移动单元,用于从资源池提取Apache服务器资源并放入配置矢量中; 所述放回单元,用于在利用配置矢量中的Apache服务器资源处理完基于Apache连接的访问请求后将该资源放回所述资源池。 A Apache server resource access means, wherein, the apparatus comprising: a receiving unit, a determining unit, a mobile unit, and a back unit, and for storing process created by the Apache server before access Apache server access request resource pools, wherein: the receiving unit for receiving the connection request based on the Apache message, provided with Apache arranged with a vector connecting corresponding connection initializing the Apache; the determining unit, for determining whether the Apache connection configuration vector is empty, if yes, trigger the mobile unit; said mobile unit, for extracting the resource from the Apache server resource pool and placed into a vector; back into the unit for utilizing the configuration vector Apache server resources back into the processed after the resource access request based on Apache connection resource pool.
  10. 10.根据权利要求9所述的装置,其特征在于,所述装置还包括保持单元,用于在利用配置矢量中的Apache服务器资源处理完基于Apache连接的访问请求之后,将该资源放回所述资源池之前,将所述Aapche服务器资源在配置矢量中保持第一预设时间阈值长度,以便在该第一预设时间阈值内接收的与基于Apache连接的访问请求共用所述Apache连接的其他访问请求使用。 10. After the apparatus according to claim 9, characterized in that said apparatus further comprises a holding Apache server resource processing unit for utilizing the configuration vectors End connection Apache access request, the resources of the back before said resource pool, the resource server Aapche holding a first threshold length of time preset in the configuration vector, in order to receive the threshold value and the first predetermined time based on the Apache connection request of the other shared connection Apache access requests.
CN 201210220297 2012-06-28 2012-06-28 Method and device for accessing Apache server resources CN102724206B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN 201210220297 CN102724206B (en) 2012-06-28 2012-06-28 Method and device for accessing Apache server resources

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 201210220297 CN102724206B (en) 2012-06-28 2012-06-28 Method and device for accessing Apache server resources

Publications (2)

Publication Number Publication Date
CN102724206A true CN102724206A (en) 2012-10-10
CN102724206B true CN102724206B (en) 2015-02-25

Family

ID=46949869

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 201210220297 CN102724206B (en) 2012-06-28 2012-06-28 Method and device for accessing Apache server resources

Country Status (1)

Country Link
CN (1) CN102724206B (en)

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101499095A (en) * 2009-03-11 2009-08-05 南京联创科技股份有限公司 Buffer construction method used for data sharing platform

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7571206B2 (en) * 2002-08-12 2009-08-04 Equallogic, Inc. Transparent request routing for a partitioned application service

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101499095A (en) * 2009-03-11 2009-08-05 南京联创科技股份有限公司 Buffer construction method used for data sharing platform

Also Published As

Publication number Publication date Type
CN102724206A (en) 2012-10-10 application

Similar Documents

Publication Publication Date Title
US20100318999A1 (en) Program partitioning across client and cloud
US20090235265A1 (en) Method and system for cost avoidance in virtualized computing environments
US20100050173A1 (en) Provisioning Virtual Resources Using Name Resolution
US20130091376A1 (en) Self-repairing database system
US20110258614A1 (en) Methods and Systems for Internally Debugging Code In an On-Demand Service Environment
US20120079490A1 (en) Distributed workflow in loosely coupled computing
US8122282B2 (en) Starting virtual instances within a cloud computing environment
US20150134796A1 (en) Dynamic partitioning techniques for data streams
US20130297673A1 (en) Mechanism for node selection for a new application in a multi-tenant cloud hosting environment
CN103092700A (en) Internal memory cleaning method and cleaning device and terminal device
CN102750324A (en) File storage system, file storage device and file access method
US8572623B2 (en) Determining an optimal computing environment for running an image based on performance of similar images
US20150186129A1 (en) Method and system for deploying a program module
Guo et al. Failure recovery: When the cure is worse than the disease
CN102025776A (en) Disaster tolerant control method, device and system
US20150135255A1 (en) Client-configurable security options for data streams
CN102142032A (en) Method and system for reading and writing data of distributed file system
Beernaert et al. Automatic elasticity in openstack
US20150150018A1 (en) Optimization of map-reduce shuffle performance through shuffler i/o pipeline actions and planning
CN102193824A (en) Virtual machine homogenization to enable migration across heterogeneous computers
US20120042163A1 (en) Securely identifying host systems
US20140366004A1 (en) Remote Debugging in a Cloud Computing Environment
US20140280441A1 (en) Data integration on retargetable engines in a networked environment
CN1514354A (en) Progress pole/linear procedure pole management method of construction member oriented backbone system internal core
CN102917077A (en) Resource allocation method in cloud computing system

Legal Events

Date Code Title Description
C06 Publication
C10 Request of examination as to substance
C14 Granted