Allocating memory in a Broker system
Memory allocation in a Broker system for managing the communication between a plurality of clients and a plurality of servers. The method may include allocating memory for a plurality of memory pools; and dividing each memory pool into memory blocks of a size which is specific to the type of a resource. The resource may be related to the communication managed by the Broker.
1. A memory allocation method in a Broker system, wherein the method comprises:
managing communication between a plurality of clients and a plurality of servers, wherein said managing is performed by the Broker system, wherein said managing comprises:
allocating memory for a plurality of memory pools, wherein said allocating is requested by threads of the Broker system using a ticket system, the ticket system being performed by a dedicated thread for performing the steps of executing instructions provided by the other threads, receiving a ticket requesting memory allocation from the other threads, and generating or allocating a new memory pool in accordance with the request; and
dividing each memory pool into memory blocks of a size which is specific to a type of a resource, wherein the resource is related to the communication managed by the Broker; and
storing data regarding the communication in one or more of the memory blocks.
2. The method of claim 1 , further comprising:
allocating a further memory pool of the specific resource type if more memory for said resource type is required during operation of the Broker.
3. The method of claim 1 , further comprising:
dynamically deallocating memory of a memory pool if the pool is not used.
4. The method of claim 3 , wherein said dynamically deallocating memory of the memory pool comprises a timeout-manager automatically issuing the deallocation of the memory of the memory pool if the memory pool is not used for a predetermined amount of time.
5. The method of claim 1 , further comprising:
dividing a memory pool into an administrative part and a data part.
6. The method of claim 5 , wherein said dividing the memory pool comprises:
dividing the data part of the memory pool into memory blocks of a fixed size.
7. The method according of claim 5 , wherein said storing comprises:
storing data with varying requirements for memory space in the data part.
8. A non-transitory computer-accessible memory medium comprising program instructions for managing memory allocation in a Broker system, wherein the Broker system manages the communication between a plurality of clients and a plurality of servers, wherein the program instructions are executable by a processor to:
allocate memory for a plurality of memory pools, wherein said allocating is requested by threads of the Broker system using a ticket system, the ticket system being performed by a dedicated thread for performing the steps of executing instructions provided by the other threads, receiving a ticket requesting memory allocation from the other threads, and generating or allocating a new memory pool in accordance with the request; and
divide each memory pool into memory blocks of a size which is specific to a type of a resource, wherein the resource is related to the communication between the plurality of clients and the plurality of servers managed by the Broker; and
store data regarding the communication in one or more of the memory blocks.
9. The memory medium of claim 8 , wherein the program instructions are further executable to:
allocate a further memory pool of the specific resource type if more memory for said resource type is required during operation of the Broker.
10. The memory medium of claim 8 , wherein the program instructions are further executable to:
dynamically deallocate memory of a memory pool if the pool is not used.
11. The memory medium of claim 10 , wherein said dynamically deallocating memory of the memory pool comprises a timeout-manager automatically issuing the deallocation of the memory of the memory pool if the memory pool is not used for a predetermined amount of time.
12. The memory medium of claim 8 , wherein the program instructions are further executable to:
divide a memory pool into an administrative part and a data part.
13. The memory medium of claim 12 , wherein said dividing the memory pool comprises:
dividing the data part of the memory pool into memory blocks of a fixed size.
14. The memory medium according of claim 12 , wherein said storing comprises:
storing data with varying requirements for memory space in the data part.
15. A Broker system for managing communications, the Broker system comprising:
a network port for coupling a network, wherein the network port is operable to communicate with a plurality of clients and a plurality of servers;
a processor; and
a memory medium coupled to the processor, wherein the memory medium comprises:
program instructions executable to manage communication between the plurality of clients and the plurality of servers, wherein the program instructions are executable to allocate a plurality of memory pools, wherein each memory pool comprises memory blocks of a size which is specific to a type of a resource, the resource being related to the communication being managed;
wherein allocation of the memory pools reduces fragmentation of the memory medium, and wherein said allocating is requested by threads of the Broker system using a ticket system, the ticket system being performed by a dedicated thread for performing the steps of executing instructions provided by the other threads, receiving a ticket requesting memory allocation from the other threads, and generating or allocating a new memory pool in accordance with the request.