Persistent queue

The queue is organized in the file system within the /var/spool/dpi/pcrf directory. An individual file is created for each fastDPI server in this directory using the pq-<fastDPI-address>:<port> name, for example, if there are two fastDPI servers described in fastpcrf.conf:

fdpi_server=127.0.0.1%lo:29000
fdpi_server=10.20.30.40:eth1:29000

then /var/spool/dpi/pcrf directory will contain two following files:

pq-127.0.0.1:29000
pq-10.20.30.40:29000 

You can change the queue directory in fastpcrf.conf by using the fdpi_pqueue_dir parameter:

   # The directory where persistent queues are created
fdpi_pqueue_dir=/var/spool/dpi/pcrf

The queue is page-organized, the size of each page equals to 2M. The maximum queue size can be specified in pages through the fdpi_pqueue_max_pagecount fastpcrf.conf parameter:

	# Max number of pages in the queue.
	# Each page size = 2M
	# 0 means that the number of pages is not limited.
	# Minimum value: 2
	# Please note that the size of queue file is limited from above by the rlimit_fsize parameter
	# There cannot be a queue larger than the size specified by rlimit_fsize.
fdpi_pqueue_max_pagecount=4

If the fastDPI server is available and its queue is empty, the data will be sent directly to the server bypassing the queue. If the server becomes unavailable, the data will be written to its queue. If the queue is full, that is, it is impossible to allocate a new page, the oldest page will be deleted from the queue, and a new one will be created in its place; thus, the queue is circular buffer.

Once the fastDPI server becomes available, all the data from its queue is sent to it. FastPCRF tries to connect to the unavailable fastDPI servers at a regular times, the timeout of these attempts is specified by the fdpi_reconnect_timeout fastpcrf.conf parameter, its default value is 2 seconds:

	# Timeout attempting to connect to fastdpi servers, in seconds
#fdpi_reconnect_timeout=2

You can manually delete the queue files when fastpcrf is stopped .

CLI-commands for managing the queues