Configure Aquiles in .NET environment is easy. You are used to work with config files all the time (*.config) that provides us this technology, understanding that for App.config we point to Win32 Applications and for Web.Config we point to AspNet Web applications.
To be able to work agains Aquiles / Cassandra we only need to follow the steps below:
1.- Add the apropiate section handler into our config file:
<?xml version="1.0" encoding="utf-8"?>
<section name="aquilesConfiguration" type="Aquiles.Core.Configuration.AquilesConfigurationSection,Aquiles.Core"/>
That the section name must be aquilesConfiguration and no other, or you Aquiles will not load and will throw a ConfigurationException when first time used.
2.- After that, we need to declare the node "aquilesConfiguration" with the following structure:
<connection poolType="SIZECONTROLLEDPOOL" factoryType="FRAMED" />
<endpointManager type="ROUNDROBIN" defaultTimeout="6000">
<add address="localhost" port="9160"/>
<connection poolType="SIZECONTROLLEDPOOL" factoryType="FRAMED">
<add key="minimumClientsToKeepInPool" value="20" />
<add key="maximumClientsToSupportInPool" value="1000" />
<add key="magicNumber" value="7" />
<endpointManager type="ROUNDROBIN" defaultTimeout="3000">
<add address="localhost" port="9160"/>
<add address="darwin" port="9160" timeout="9000"/>
Now, lets take a close view for each of the nodes
In case that you want to see what's happening inside this box, you may do it by implementing from LoggerHelper
. Aquiles will use that class to create an instance of it and route all the logging information through it. Then, you only need to add the whole Type of your class in the config to let Aquiles properly instanciate it.Note:
If you put an invalid class, or the class is not found an Exception during Initialization will be thrown.
Since version 0.7.0.6, Aquiles support to hook an IMonitorFeatures class implementation from its configuration section to send all the health information into some repository. Natively, Aquiles supports, by using the library PerformanceCounterHelper
, sending all such information into Performance Monitor that is built in Windows. To enable this feature, you will need to register the IMonitorFeatures implementation doing something like the following:
The following information will be then monitorized within the new Category Aquiles - Performance Counters
- Number of Active connections
- Number of Free connections
- Number of invalid connections
- Number of created connections
- Number of destroyed connections
- Average Time on borrowing a connection from the pool, expressed in milliseconds.
- Average Time on returning a connection to the pool, expressed in milliseconds.
- Average Time on invalidate a connection to the pool, expressed in milliseconds.
- Number of Active endpoints
- Number of banned endpoints
- Average Time on command execution, expressed in milliseconds.
The node cluster, is basically a container for a collection of configured clusters, Here you can "add", "remove", "clear" any cluster previously defined in the Configuration Heriachy.
Add a cluster
If you want to add a cluster, after the "<clusters>" node, put and "<add " and start adding the following attribute information:
- friendlyName: a friendly name to call this configured cluster within your application. Note that by this name you will need to reference this cluster.
Remove a cluster
Consider this scenario, you have got a master config file with a cluster defined for you all Web Applications in your root directory, now, in a child Web Application, you decided that you don't need that cluster anymore, then, knowing the friendly name of the cluster to be removed, you add a "<remove friendlyName='XXXX'>".
<remove friendlyName="TestClusterX" />
Clearing all previous defined clusters
Ok, in the scenario that you want to get rid of all the previously defined clusters (because you want to start over with your application) you may add the following in your "<clusters>" node.
Within the connection node, you will find the following attributes:
- poolType: Defines what type of pool to use. The actual valid values are:
- NOPOOL: will make a faked pool where actually no pool strategy will be used (each time you need a connection, a new connection is created and when you release it or invalidate it, the connection will be destroyed. See NoConnectionPool.
- SIZECONTROLLEDPOOL: will make use of SizeControlledConnectionPool. See class details on the pooling mechanism.
- factoryType: Defines how what kind of protocol to use when creating new connections. The actual valid values are:
As a child node, there is a "specialConnectionParameters", inside this node, you will need to add a list of key-values accordingly to the poolType
previously defined. So see each implementation to see what are the key that they need.
The endpointManager node, will define which will be the manage strategy to use, and what are the associated endpoints for that cluster. The following attributes are required:
- type: Type of endpoint manager to use. The actual valid values are:
- ROUNDROBIN: this strategy will cycle through all the endpoints define, giving a Round Robin alike mechanism when retrieving an endpoint to create a connection against to.
- defaultTimeout*: the default timeout value for all the endpoints, in case each one of these don't defined a particular one. Only int values greater than 0 are allowed.
This node is a collection alike container that only supports the add operation. The attributes each add may have are the followings:
- address: the address of one node of the Cassandra Cluster. It may have a DNS name or an IP.
- timeout: the particular endpoint timeout. Only int values greater than 0 are allowed. This attribute is optional since you have the defaultTimeout.