Implementation of a simple endpoint proxy webservice as part of EIDA NG. The service implements shunting requests into a queue in order to prevent endpoint webservices from overload. Thus, in contrast to Apache2's mod_bw or the NGINX's limit_conn configuration option, it implements the Leaky Bucket Algorithm instead of returning immediately an error to the client. Limited access to the proxied endpoint resource is granted by a configurable connection pool size.
The service is intented to be used in conjunction with eidaws-federator
and
thus implements proxying the following resources:
/fdsnws/dataselect/1/query
/fdsnws/station/1/query
/eidaws/wfcatalog/1/query
The implementation is based on Python's aiohttp framework.
Download:
Clone the repository:
git clone https://github.com/EIDA/eidaws.git && cd eidaws
Installation:
In order to install the eidaws.endpoint_proxy
service, invoke
pip install eidaws.utils pip install eidaws.endpoint_proxy
Note, that encapsulating the installation by means of a virtual environment is strongly recommended.
Running:
In order to run the service simply invoke:
eida-endpoint-proxy
Additional information and help is provided when invoking the application with
the -h|--help
flag. I.e.
eida-endpoint-proxy -h
The service is configured by means of a YAML configuration file. An exemplary fully
documented configuration file is provided under
eidaws.endpoint_proxy/config/eidaws_proxy_config.yml.example
. In order to
change the default configuration make a copy of the example configuration with
e.g.
cp -v eidaws.endpoint_proxy/config/eidaws_proxy_config.yml.example \ eidaws.endpoint_proxy/config/eidaws_proxy_config.yml
and adopt the file according to your needs. Then start the application with
the -c|--config
flag e.g.
eida-endpoint-proxy -c eidaws.endpoint_proxy/config/eidaws_proxy_config.yml
The eidaws.endpoint_proxy distribution uses standard logging for tracking
the application activity. Besides of loggers from aiohttp
an
application specific logger named eidaws.endpoint_proxy
is provided.
When configuring logging by means of a logging configuration file (see also the Configuration section), you may subscribe to these loggers for getting log messages.
The bandwiths limitation is based on the facilities provided by aiohttp's TCPConnector facilities. Thus, the queue size is not configurable.
Full featured bandwith limitation is implemented by e.g. the bottleneck package. In future, an improved implementation might be based on these facilites.