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 CN201210220297.3A CN201210220297A CN102724206B CN 102724206 B CN102724206 B CN 102724206B CN 201210220297 A CN201210220297 A CN 201210220297A CN 102724206 B CN102724206 B CN 102724206B
Authority
CN
China
Prior art keywords
resource
apache
access request
apache server
server
Prior art date
Legal status (The legal status 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 status listed.)
Active
Application number
CN201210220297.3A
Other languages
Chinese (zh)
Other versions
CN102724206A (en
Inventor
傅飞
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Sohu New Media Information Technology Co Ltd
Original Assignee
Beijing Sohu New Media Information Technology Co Ltd
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
Application filed by Beijing Sohu New Media Information Technology Co Ltd filed Critical Beijing Sohu New Media Information Technology Co Ltd
Priority to CN201210220297.3A priority Critical patent/CN102724206B/en
Publication of CN102724206A publication Critical patent/CN102724206A/en
Application granted granted Critical
Publication of CN102724206B publication Critical patent/CN102724206B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the invention discloses a method for accessing Apache server resources. The method comprises the following steps of: receiving an Apache-connection-based access request message, wherein a configuration vector corresponding to Apache connection is set during the initialization of the Apache connection; judging whether the configuration vector is null or not, and if the configuration vector is null, extracting the resources from an Apache server resource pool, and placing the resources into the configuration vector, wherein the resource pool for storing the Apache server resources processing an access request is created before an Apache server is accessed; and after the access request is processed by the Apache server resources in the configuration vector, returning the resources to the resource pool. The embodiment of the invention also discloses a device for accessing the Apache server resources. By the embodiment of the invention, the access efficiency of the Apache server resources is improved.

Description

A kind of access method of Apache Server resource and device
Technical field
The application relates to server resource access technique field, particularly relates to a kind of access method and related device of Apache Server resource.
Background technology
Apache Server is a powerful, famous WEB server of increasing income that favorable expandability, stability are strong, and it may operate on nearly all widely used computer platform.When user is by browser access Apache Server, after Apache Server receives the access request that client (passing through browser) sends, according to the Apache Server resource of this access request demand of process, create corresponding resource, then utilize this resource to complete the process of client-access request, Apache Server resource discharges after finishing using.When same client access next time or the same asset of other client-access Apache Servers, Apache Server will re-create this resource to process the access request of client.But the asset creation cost of Apache Server is higher, such as mysql connects, memcache connects, under the environment that performance requirement is strict, the resource that repeated multiple times establishment is identical, its total establishment cost can accept hardly, has had a strong impact on the access efficiency of Apache Server resource.
Summary of the invention
For solving the problems of the technologies described above, the embodiment of the present application provides a kind of access method of Apache Server resource and corresponding device, to improve the access efficiency of Apache Server resource.
The access method of the Apache Server resource that the embodiment of the present application provides comprises:
Receive the access request message connected based on Apache, be provided with when described Apache connects initialization and connect corresponding configuration vector with Apache;
Judge whether the configuration vector that described Apache connects is empty, if so, then extracts Apache Server resource from resource pool, and puts into configuration vector; Described resource pool created before Apache Server is accessed, for depositing the Apache Server resource of process access request;
After utilizing the Apache Server resource in configuration vector to process the access request connected based on Apache, this resource is put back to described resource pool.
Preferably, after Apache Server resource in utilization configuration vector processes described access request, before this resource is put back to described resource pool, described Aapche server resource is kept the first preset time threshold length in configuration vector, so as to receive in this first preset time threshold share with the access request message be connected based on Apache other access request that described Apache connects and use.
Preferably, describedly extract Apache Server resource from resource pool and specifically comprise: the acquisition function of Apache Server utilizes incompatible lock mechanism from resource pool, extract Apache Server resource, different to guarantee each Apache Server resource extracted.
Preferably, described resource pool created and specifically comprises before Apache Server is accessed:
The Hook Function registered callbacks function of Apache Server;
Call call back function establishing resource pond before Apache Server is accessed.
Preferably, after described resource pool has created, described method has also comprised:
Read preset configuration file, the parameter configuration resource pool utilizing configuration file to comprise, the parameter that described configuration file comprises comprises resource pool and meets the minimum resources number of application requirement, open ended maximum resource number, the maximum number of establishing resource and/or the resource term of validity.
Preferably, in the access request process utilizing the Apache Server resource process in configuration vector to connect based on Apache, described method also comprises: place moment when described resource can not normally be used is recorded as resource failed discovery time, then:
When starting resource availability verification, obtain Apache Server resource failed discovery time, and judge whether the difference of resource availability verification Startup time and Apache Server resource failed discovery time is greater than the second preset time threshold, if so, then this resource is analysed structure and is gone out resource pool by the destructor function calling Apache Server.
Further preferably, described resource to be analysed after structure goes out resource pool at the destructor function calling Apache Server, the constructed fuction calling Apache Server re-creates described resource.
Preferably, described Apache Server resource comprises mysql connection and/or memcache connection.
The embodiment of the present application additionally provides a kind of access means of Apache Server resource.This device comprises: receiving element, judging unit, mobile unit and put back to unit, and the resource pool of the Apache Server resource for depositing process access request created before Apache Server is accessed, wherein:
Described receiving element, for receiving the access request message connected based on Apache, being provided with when described Apache connects initialization and connecting corresponding configuration vector with Apache;
Described judging unit, for judging whether the configuration vector that described Apache connects is empty, if so, then triggers mobile unit;
Described mobile unit, for extracting Apache Server resource from resource pool and putting into configuration vector;
Describedly put back to unit, for this resource being put back to described resource pool after utilizing the Apache Server resource in configuration vector to process the access request connected based on Apache.
Preferably, described device also comprises holding unit, for after the access request utilizing the Apache Server resource configured in vector to process based on Apache connection, before this resource is put back to described resource pool, described Aapche server resource is kept the first preset time threshold length in configuration vector, uses to share other access request that described Apache connects in this first preset time threshold receives with the access request be connected based on Apache.
The embodiment of the present application is after receiving the access request message connected based on Apache, judge whether the configuration vector field that described Apache connects is empty, if be empty, then from the resource pool of the Apache Server resource for depositing process access request created before Apache Server is accessed, extract Apache Server resource; After utilizing the Apache Server resource in configuration vector to process described access request, this resource is put back to resource pool.Compared with prior art, the embodiment of the present application is owing to creating the resource pool for depositing Apache Server resource before being accessed at Apache Server, access end is when accessing the resource of Apache Server, if there is not corresponding resource in configuration vector can extract resource from resource pool, and need not re-create by Apache Server when each access same asset and need resource, thus improve the resource access efficiency of Apache Server.
Accompanying drawing explanation
In order to be illustrated more clearly in the embodiment of the present application or technical scheme of the prior art, be briefly described to the accompanying drawing used required in embodiment or description of the prior art below, apparently, the accompanying drawing that the following describes is only some embodiments recorded in the application, for those of ordinary skill in the art, under the prerequisite not paying creative work, other accompanying drawing can also be obtained according to these accompanying drawings.
Fig. 1 is the flow chart of an Apache Server resource access method embodiment of the application;
Fig. 2 is the flow chart of another Apache Server resource access method embodiment of the application;
Fig. 3 is the composition frame chart of the Apache Server resource access device embodiment of the application.
Embodiment
Technical scheme in the application is understood better in order to make those skilled in the art person, below in conjunction with the accompanying drawing in the embodiment of the present application, technical scheme in the embodiment of the present application is clearly and completely described, obviously, described embodiment is only some embodiments of the present application, instead of whole embodiments.Based on the embodiment in the application, those of ordinary skill in the art are not making the every other embodiment obtained under creative work prerequisite, all should belong to the scope of the application's protection.
See Fig. 1, the figure shows the flow process of the access method embodiment of an Apache Server resource of the application.This embodiment comprises:
Step S101: receive the access request message connected based on Apache, is provided with when described Apache connects initialization and connects corresponding configuration vector with Apache;
Apache Server is as the network terminal providing service, and it is by the repeatedly access request of the access request that constantly receives from different clients (browser) or same client.These access request are all based on Apache connection (Apache connection), and " connection " here once set up, then both can process individual access request, also can process multiple access request simultaneously.Apache connection is set up between client (browser) and Apache Server when first reception access request usually, and concrete process of establishing belongs to prior art, no longer describes in detail here.When setting up Apache and connecting, Apache Server also can initialization one the resource configuration vector (configuration vector) corresponding with this connection, the resource of the Apache Server of access request of this configuration vector for storing, converging, call process and connect based on Apache.In the access request message of client except necessary communication elements (such as source address, destination address, routing iinformation etc.); usually also comprise the resource requirement needing server to provide, call the process that the resource met the demands can realize this access request.Here resource comprises polytype, can carry out different divisions according to different standards, such as divides according to functional mode, common are mysql connection, memcache connection etc.; Divide according to the form of expression, can be divided into basic resources and derivative resource, basic resources is the required resource of process access request, and derivative resource is the resource formed carry out the operations such as compound, succession, encapsulation on basic resources basis after.
Step S102: judge whether the configuration vector that described Apache connects is empty, if so, performs step S103, if not, performs step S104;
After Apache Server receives the access request of client, by judge described access request based on Apache whether connect corresponding configuration vector be that sky determines whether to need to extract resource.If the client sending access request accesses Apache Server first, then between Apache Server with client (browser), set up Apache to be first connected, in this case Apache connects corresponding configuration vector and is just established, and there is not the Apache resource of process access request.Apache Server is accessed first and with time difference of previous access request within a values if the client sending access request is non-, or, although be access first, but the client of this access is connected with vertical Apache built between Apache Server, and the processed access request connected based on this Apache of Apache Server, then this Apache connects corresponding configuration vector is not under normal circumstances empty.Therefore, the situation by judging to configure vector knows whether the resource of process access request exists, thus can take different disposal measure for different situations.
Step S103: extract Apache Server resource and put into configuration vector from resource pool, proceeding to step S104;
If the configuration vector field of access request message is empty, the resource not processing access request in the configuration vector connected based on Apache is described, in this case, Apache Server can extract resource from resource pool, and this resource is put among configuration vector, for this access request of process.The embodiment of the present application does not limit the resource extracting any type (function) from resource pool and uses to the access request of client.Certainly, in actual applications, priority ordering can be carried out to the resource in resource pool as required, provide resource according to priority size, also can predicting the demand of access request, providing resource according to predicting the outcome.Here " resource pool " created before Apache Server is accessed, and for depositing the Apache Server resource of process access request, these resources are generally reused " renewable " resource." Apache Server accessed before " comprises any time before Apache Server access, can be such as Apache Server when starting, also can be after Apache Server starts before unlatching service function establishing resource pond.
For the establishment mode of resource pool, difference as the case may be, can comprise multiple.The method in a kind of establishing resource pond that the present embodiment provides comprises: the Hook Function that Apache Server first calls Apache portable Runtime Library (Apache portable Run-time vlibraries) registers a call back function, by this call back function establishing resource pond, in resource pool constructive process, add resource by resource pool.Can be configured resource pool further after resource pool has created.Such as, read preset configuration file, the parameter comprised in configuration file is utilized to be configured resource pool, these parameters comprise the minimum resources number, open ended maximum resource number, the maximum number of establishing resource, the resource term of validity etc. that meet application and require, can be the one in these parameters, also can be several combinations.By being configured the customized management that can realize resource pool to resource pool.
For the mode extracting resource from resource pool, also comprise multiple specific implementation.A kind of mode that the present embodiment provides calls the acquisition function of Apache Server (such as, vapr_relist_acquire function) Gains resources.
If the configuration vector field of access request message is not empty, illustrating that access end connects based on described Apache the access request initiated is not access request first, the resource of process access request has been there is in configuration vector, in this case, can directly be used, without the need to extracting resource from resource pool to the resource in configuration vector.
Step S104: after utilizing the Apache Server resource in configuration vector to process described access request, this resource is put back to described resource pool;
Have by making configuration vector from resource pool acquisition after previously having there is Apache Server resource in Aapche server resource or confirmation configuration vector, these resource process access request can be utilized.After the process completing process request, this resource is placed back resource pool, the constancy of this resource quantity that can keep in resource pool, so that other need the access request utilizing this same asset to use.
Known by foregoing description, the technical scheme of the present embodiment is after receiving the access request message connected based on Apache, by judging that described Apache connects the step of the situation decision operation of corresponding configuration vector, configuration vector extracts resource when being empty from resource pool, and is placed in configuration vector; After determining, in configuration vector, there is Apache Server resource, utilize this resource to complete the process of access request, be disposed and the resource of access put back to resource pool.The program compared with prior art, the present embodiment is owing to creating the resource pool of the Apache Server resource for depositing process access request before being accessed at Apache Server, access end can the Apache situation that connects corresponding configuration vector determine to extract resource from resource pool when accessing the resource of Apache Server, and need not re-create by Apache Server when each access same asset and need resource, save asset creation cost, add the recycling rate of waterused of resource, thus improve the resource access efficiency of Apache Server.
The Apache Server resource utilized in the step S104 of above-described embodiment, due to the characteristic of resource itself or the setting to the resource term of validity in resource pool, the resource of acquisition may lose efficacy.If the resource obtained lost efficacy, cannot meet the user demand of process access request on the one hand, the resource for this inefficacy may need to carry out resource and re-create to replace this resource; On the other hand by the space of waste resource pool, need from resource pool, these resources lost efficacy to be removed.May be in this case invalid in the resource of resource pool, the application preferably judges the resource availability of resource, and takes appropriate measures according to the result judged, forms another resource access method embodiment of the application thus.See Fig. 2, the figure shows the flow process of this embodiment.This embodiment comprises:
Step S201: receive the access request message connected based on Apache, is provided with when described Apache connects initialization and connects corresponding configuration vector with Apache;
Step S202: judge whether the configuration vector that described Apache connects is empty, if so, performs step S203, if not, performs step S204;
Step S203: the acquisition function calling Apache Server extracts resource from resource pool, and the resource of extraction is put into configuration vector;
Step S204: utilize access request described in the Apache Server resource process in configuration vector;
Step S205: whether monitoring Apache Server resource can normally use, and if so, then performs step S207; If not, then step S206 is performed;
Step S206: place moment when can not use is recorded as the inefficacy discovery time of described Apache Server resource;
The present embodiment takes passive type mechanism to the judgement whether Apache Server resource lost efficacy, namely judged by the situation of the implementation utilizing Apache Server resource process access request, if this resource can not normal running in execution process access request process, then think that this resource lost efficacy, but current time early than current time, may be recorded as the discovery time of Apache resource failed here by the real time of this resource failed; If this resource can normally perform in execution process access request, do not go wrong, illustrate that this resource is still effective, can continue to put back to resource pool and again utilize.Except above-mentioned this passive type judges resource failed whether mode, formula of can also taking the initiative mechanism, namely by extra special procedure, the Apache resource in resource pool is checked one by one, if the time that resource retains in resource pool (standby time) has exceeded Resource Valid Time, then think and this resource failed at this moment the current time being checked through resource failed is recorded as the inefficacy discovery time of this resource.Be found the resource lost efficacy, in most of the cases, do not destroy immediately, or re-establish this resource immediately after destroying, and whether take above-mentioned measure and when take above-mentioned measure to need to determine according to follow-up resource clean-up operations.
Step S207: after access request is disposed, Apache Server resource is put back to resource pool;
In the present embodiment, " resource is returned and put " operation realizes by call back function, specifically, first register a corresponding call back function when Apache Server resource in resource pool being added to configuration vector, perform back and put function needing to call when the Apache Server resource of finishing using being returned and put resource pool this call back function.
Step S208: when starting resource availability verification, obtain Apache resource failed discovery time, judge that resource availability checks whether the difference of Startup time and Apache Server resource failed discovery time is greater than the second preset time threshold, if so, then perform step S209; If not, then process ends;
As previously mentioned, even if Apache Server resource is found to be stale resource will, and record the discovery time of this resource failed, but this resource be uninevitable or destroy immediately, and need the resource availability verification work of this step.The start-up time that the resource availability of the present embodiment is verified can determine according to actual conditions, can select again to extract from resource pool after Apache Server resource puts into configuration vector, resource availability inspection is carried out before utilizing this resource process access request, like this once find that the resource extracted lost efficacy, from resource pool, then again can extract the resource for process access request, and just find that resource had lost efficacy without the need to by the time utilizing in this resource process access request process, thus save the treatment effeciency of access request; Also Apache Server can be selected not process in the idle period of access request, validity check is carried out to the resource of resource pool, the live load of Apache Server can be reduced like this, be uniformly distributed the calculation processing power of Apache Server.In addition, work resource in resource pool being carried out to validity verification periodically can be carried out automatically according to prefixed time interval, also can carry out in real time in reception, process such as process access request etc., no matter which kind of mode, all can realize the goal of the invention of the embodiment of the present application.Here the second preset time threshold can be selected according to actual conditions such as the historical datas of the live load of Apache Server, resource availability.
Step S209: this resource is analysed structure and gone out resource pool by the destructor function calling Apache Server, and the constructed fuction calling Apache Server re-creates described resource, process ends.The resource re-created still is positioned among resource pool, for replacing the resource of described inefficacy.
Known by foregoing description, the self-regeneration process of the resource pool of the present embodiment is completed by two work coordinations: one is the discovery procedure of whether losing efficacy to resource; Two is verify process to resource the need of analysing the cleaning that structure rebuilds, last process be after the prerequisite of a process, not to resource failed whether discovery registration, just can not carry out resource and analyse the cleaning management that structure rebuilds.Based on this, the present embodiment makes resource utilize the effective situation of automatic discovery inefficacy in process, and initiatively carries out self-regeneration, the machine-processed various demands that fully can meet access end of this flexible, dynamic resource pool.In fact, except the self-management of above-mentioned this resource pool, other measures can also be taked to realize management, realize the management of resource as by the independent management thread of establishment.
When the acquisition function calling Apache Server in above-mentioned two embodiments extracts resource from resource pool, the application does not limit the mode of concrete Gains resources, obtain function and can obtain a resource from resource pool, also can obtain multiple resource and be supplied to access request use; Also do not limit the resource of resource pool and the relation of Apache worker thread, they can have equivalent quantity, also can not have equivalent quantity.But in actual applications, in order to improve the efficiency of resource access further, prevent the resource in Resource Access or acquisition process from fighting for phenomenon, the application preferably takes two kinds of measures: one is adopt incompatible lock mechanism.Mutual exclusion lock is by locking resource pool when access resources pond, thus guarantee that other access request can not carry out Resource Access when the resource of each extraction resource pool, and each resource extracted is different, phenomenons such as preventing Resource Access mistake, obscure, fight for occurs.Two is that acquiescence Apache worker thread is identical with resource quantity in resource pool, can ensure that each worker thread has one's own resource object like this, avoid fighting for resource and cause performance loss.
Step S104, S206 in above-mentioned two embodiments, after the Apache Server resource of utilization configuration vector is disposed access request, can put back to resource pool by Apache Server resource immediately, so that the access request use connected based on other Apache.But, in actual applications, known based on Probability Statistics Theory, client (browser) with establish after Apache is connected between Apache Server, the usual also continued presence within a period of time of access request based on this connection, if the Apache Server resource be about to after previous access request processes in configuration vector puts back to resource pool, so in the back to back next access request connected based on this same Apache, needs are again obtained Apache Server resource from resource pool, this will increase the operating time, reduce the access efficiency of resource.For this reason, described Aapche server resource before this resource is put back to described resource pool, is kept the first preset time threshold length after processing described access request by the Apache Server resource of the application preferably in utilization configuration vector in configuration vector.In this way, when other access request connected based on same Apache in this first preset time threshold arrive, just resource pool is not needed to go to extract Apache resource, and directly can utilize during the previous access request of process and remain on resource in the configuration vector of this connection correspondence, thus improve resource access efficiency.Here the first preset time threshold can receive the actual conditions decision of access request according to Apache Server, such as, in most of the cases, the access request received in 5 minutes is more, the access request received after 5 minutes is less, then this preset time threshold can be set as 5 minutes.
Above content describes the embodiment of the method for the application in detail, correspondingly, present invention also provides a kind of resource access device based on Apache Server.
See Fig. 3, the figure shows the structural representation of the application's resource access device embodiment.This device embodiment comprises: receiving element 301, judging unit 302, mobile unit 303 and put back to unit 304, and the resource pool 305 for depositing Apache Server resource created before Apache Server is accessed, wherein:
Receiving element 301, for receiving the access request message connected based on Apache, being provided with when described Apache connects initialization and connecting corresponding configuration vector with Apache;
Judging unit 302, for judging whether the configuration vector that described Apache connects is empty, if so, then triggers mobile unit;
Mobile unit 303, for extracting Apache Server resource from resource pool and putting into configuration vector;
Put back to unit 304, for this resource being put back to described resource pool after utilizing the Apache Server resource in configuration vector to process described access request.
The course of work of this device embodiment is: receiving element receives the access request message connected based on Apache, judge whether corresponding with it the configuration vector that Apache is arranged when connecting initialization is empty by judging unit 302, if, then trigger mobile unit 303, from resource pool, extract Apache Server resource by mobile unit 303 and put into configuration vector; After utilizing Apache Server resource to process access request, by putting back to unit 304, this is put back to described resource pool.
This device embodiment is after receiving the access request message connected based on Apache, and whether be empty, if be empty, then from resource pool, extract resource and put into configuration vector if judging that Apache connects corresponding configuration vector; After utilizing described resource to process access request, this resource is put back to resource pool.Compared with prior art, this device embodiment is owing to creating the resource pool of the resource for depositing Apache Server before being accessed at Apache Server, access end can extract resource when accessing Apache Server resource from resource pool, and need not re-create by Apache Server when each access same asset and need resource, thus improve the resource access efficiency of Apache Server.
Holding unit can also be comprised in said apparatus embodiment, after processing described access request for the Apache Server resource in utilization configuration vector, before this resource is put back to described resource pool, described Aapche server resource is kept the first preset time threshold length in configuration vector, uses to share other access request that described Apache is connected in this first preset time threshold with described access request message.Like this, the convenience that resource uses can be strengthened, improve the whole efficiency of resource access.
Incompatible lock mechanism can be taked when the acquisition function that acquiring unit in said apparatus embodiment calls Apache Server extracts resource from resource pool, different to guarantee each resource extracted, the appearance of phenomenons such as can avoiding Resource Access mistake like this, obscure, fight for.Problem is fought for for preventing this resource, can also be configured resource pool, by receive configuration parameter to the open ended maximum resource number of resource pool, meet the minimum resources number of application demand, the term of validity of resource, and the relation etc. between the resource number created in resource pool and Apache active line number of passes.Can be carried out the customization of resource pool by these configurations, thus raising resource access efficiency, minimizing resource are fought for and conflict.Such as, if the resource number created in resource pool is equal with Apache active line number of passes, the resource object of each worker thread use oneself can be ensured, avoid fighting for resource and cause performance loss.
What needs further illustrated is, aforesaid several embodiment refer to the concept such as resource and resource pool, for simplicity, call like multiple types is adopted when using these concepts, the Apache Server resource of such as Apache Server resource, process access request, Apache resource, repetition available resources, resource etc., but those of ordinary skill in the art know, under the linguistic context of the application place technical field, these different words have equivalent implication in itself, should do same or similar understanding.For the concept of resource pool, its function is the Apache resource of placing process access request, these are in the difference of the resource in resource pool according to actual conditions, there is multiple concrete organizational form, the more common reslist of Apache Server that such as adopts carries out resource organizations, reslist is a data structural chain table in essence, it is the instrument that APR provides, this instrument has following function: (1) can specify the restricted number of the resource managed in reslist, than least resource number as the aforementioned, maximum resource number, maximum number of establishing resource etc., (2) provide constructed fuction (constructor) and the destructor function (deconstructor) of resource, the former is for rebuilding the resource in resource pool, and the latter is used for resource to destroy from resource pool, (3) functions such as the reading time-out obtaining resource items from reslist is arranged.The various function all described above utilizing the reslist of Apache Server to provide, can realize the management of the data (resource) to resource pool.
For convenience of description, various unit is divided into describe respectively with function when describing above device.Certainly, the function of each unit can be realized in same or multiple software and/or hardware when implementing the application.
As seen through the above description of the embodiments, those skilled in the art can be well understood to the mode that the application can add required general hardware platform by software and realizes.Based on such understanding, the technical scheme of the application can embody with the form of software product the part that prior art contributes in essence in other words, this computer software product can be stored in storage medium, as ROM/RAM, magnetic disc, CD etc., comprising some instructions in order to make a computer equipment (can be personal computer, server, or the network equipment etc.) perform the method described in some part of each embodiment of the application or embodiment.
Each embodiment in this specification all adopts the mode of going forward one by one to describe, between each embodiment identical similar part mutually see, what each embodiment stressed is the difference with other embodiments.Especially, for system embodiment, because it is substantially similar to embodiment of the method, so describe fairly simple, relevant part illustrates see the part of embodiment of the method.System embodiment described above is only schematic, the wherein said unit illustrated as separating component or can may not be and physically separates, parts as unit display can be or may not be physical location, namely can be positioned at a place, or also can be distributed in multiple network element.Some or all of module wherein can be selected according to the actual needs to realize the object of the present embodiment scheme.Those of ordinary skill in the art, when not paying creative work, are namely appreciated that and implement.
The application can be used in numerous general or special purpose computing system environment or configuration.Such as: personal computer, server computer, handheld device or portable set, laptop device, multicomputer system, system, set top box, programmable consumer-elcetronics devices, network PC, minicom, mainframe computer, the distributed computing environment (DCE) comprising above any system or equipment etc. based on microprocessor.
The application can describe in the general context of computer executable instructions, such as program module.Usually, program module comprises the routine, program, object, assembly, data structure etc. that perform particular task or realize particular abstract data type.Also can put into practice the application in a distributed computing environment, in these distributed computing environment (DCE), be executed the task by the remote processing devices be connected by communication network.In a distributed computing environment, program module can be arranged in the local and remote computer-readable storage medium comprising memory device.
The above is only the embodiment of the application; it should be pointed out that for those skilled in the art, under the prerequisite not departing from the application's principle; can also make some improvements and modifications, these improvements and modifications also should be considered as the protection range of the application.

Claims (10)

1. an access method for Apache Server resource, is characterized in that, the method comprises:
Receive the access request message connected based on Apache, be provided with when described Apache connects initialization and connect corresponding configuration vector with Apache;
Judge whether the configuration vector that described Apache connects is empty, if so, then extract Apache Server resource from resource pool and put into configuration vector; Described resource pool created before Apache Server is accessed, for depositing the Apache Server resource of process access request;
After utilizing the Apache Server resource in configuration vector to process the access request connected based on Apache, this resource is put back to described resource pool.
2. method according to claim 1, it is characterized in that, after Apache Server resource in utilization configuration vector processes described access request, before this resource is put back to described resource pool, described Aapche server resource is kept the first preset time threshold length in configuration vector, so as to receive in this first preset time threshold share with the access request message be connected based on Apache other access request that described Apache connects and use.
3. method according to claim 1, is characterized in that, describedly extracts Apache Server resource from resource pool and specifically comprises:
The acquisition function of Apache Server utilizes incompatible lock mechanism to extract Apache Server resource from resource pool, different to guarantee each Apache Server resource extracted.
4. method according to claim 1, is characterized in that, described resource pool created and specifically comprises before Apache Server is accessed:
The Hook Function registered callbacks function of Apache Server;
Call call back function establishing resource pond before Apache Server is accessed.
5. method according to claim 1, is characterized in that, after described resource pool has created, described method also comprises:
Read preset configuration file, the parameter configuration resource pool utilizing configuration file to comprise, the parameter that described configuration file comprises comprises resource pool and meets the minimum resources number of application requirement, open ended maximum resource number, the maximum number of establishing resource and/or the resource term of validity.
6. method according to claim 5, it is characterized in that, described method also comprises: in the access request process utilizing the Apache Server resource process in configuration vector to connect based on Apache, place moment when described resource can not normally be used is recorded as resource failed discovery time, then:
When starting resource availability verification, obtain Apache Server resource failed discovery time, and judge whether the difference of resource availability verification Startup time and Apache Server resource failed discovery time is greater than the second preset time threshold, if so, then this resource is analysed structure and is gone out resource pool by the destructor function calling Apache Server.
7. method according to claim 6, is characterized in that, resource to be analysed after structure goes out resource pool at the destructor function calling Apache Server, the constructed fuction calling Apache Server re-creates described resource.
8. method according to claim 1, is characterized in that, described Apache Server resource comprises mysql and connects and/or memcache connection.
9. the access means of an Apache Server resource, it is characterized in that, this device comprises: receiving element, judging unit, mobile unit and put back to unit, and the resource pool of the Apache Server resource for depositing process access request created before Apache Server is accessed, wherein:
Described receiving element, for receiving the access request message connected based on Apache, being provided with when described Apache connects initialization and connecting corresponding configuration vector with Apache;
Described judging unit, for judging whether the configuration vector that described Apache connects is empty, if so, then triggers mobile unit;
Described mobile unit, for extracting Apache Server resource from resource pool and putting into configuration vector;
Describedly put back to unit, for this resource being put back to described resource pool after utilizing the Apache Server resource in configuration vector to process the access request connected based on Apache.
10. device according to claim 9, it is characterized in that, described device also comprises holding unit, for after the access request utilizing the Apache Server resource configured in vector to process based on Apache connection, before this resource is put back to described resource pool, described Aapche server resource is kept the first preset time threshold length in configuration vector, so as to receive in this first preset time threshold share with the access request be connected based on Apache other access request that described Apache connects and use.
CN201210220297.3A 2012-06-28 2012-06-28 Method and device for accessing Apache server resources Active CN102724206B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210220297.3A 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
CN201210220297.3A CN102724206B (en) 2012-06-28 2012-06-28 Method and device for accessing Apache server resources

Publications (2)

Publication Number Publication Date
CN102724206A 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
CN201210220297.3A Active 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)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115801889A (en) * 2022-08-19 2023-03-14 中国银联股份有限公司 Communication resource management system, communication resource management method, and storage medium

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
CN102724206A (en) 2012-10-10

Similar Documents

Publication Publication Date Title
CN104199711B (en) The method and apparatus for establishing root authority
CN105282047A (en) Access request processing method and device
CN111258867B (en) Public cloud dial testing method and device
CN106034138A (en) Remote service calling method and remote service calling device
CN110740057A (en) service deployment method and block chain platform
CN106934027A (en) Distributed reptile realization method and system
CN107888706A (en) Cloud product bug processing method, device, equipment and computer-readable recording medium
CN109446062B (en) Method and device for debugging software in cloud computing service
CN108959046B (en) Information processing method, equipment and device
CN104537284B (en) Software protecting system and method based on remote service
CN113608751B (en) Operation method, device and equipment of reasoning service platform and storage medium
CN109768962B (en) Firewall strategy generation method and device, computer equipment and storage medium
CN102724206B (en) Method and device for accessing Apache server resources
CN109450724A (en) A kind of test method and relevant apparatus of NFS internal memory optimization function
CN104967515A (en) Identity authentication method and server
CN109218371B (en) Method and equipment for calling data
EP3299960B1 (en) Virtual machine deployment method, device and network function virtualization orchestrator (nfvo)
CN114978856A (en) Multi-cloud computing management platform and method
CN103051607B (en) Access method, equipment and system
CN111124547B (en) Task processing method and device
CN110365742B (en) Multi-active load balancing application creation method and device, computer equipment and storage medium
CN106909832A (en) The installation method and device of a kind of application program
CN110955579A (en) Ambari-based large data platform monitoring method
CN111240805A (en) Cloud operating system user switching processing method and device
CN112416321B (en) Application generation method and device, storage medium and electronic device

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CP02 Change in the address of a patent holder

Address after: 100086 12, 1201, 3 building, 2 South Road, Haidian District Academy of Sciences, Beijing.

Patentee after: Beijing Sohu New Media Information Technology Co., Ltd.

Address before: 100084 Beijing Haidian District Zhongguancun East Road 1 hospital 9 building Sohu cyber Building 8 floor 802 room.

Patentee before: Beijing Sohu New Media Information Technology Co., Ltd.

CP02 Change in the address of a patent holder