mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-30 19:42:00 +00:00
67c2e50331
* update presentations * CLICKHOUSE-2936: redirect from clickhouse.yandex.ru and clickhouse.yandex.com * update submodule * lost files * CLICKHOUSE-2981: prefer sphinx docs over original reference * CLICKHOUSE-2981: docs styles more similar to main website + add flags to switch language links * update presentations * Less confusing directory structure (docs -> doc/reference/) * Minify sphinx docs too * Website release script: fail fast + pass docker hash on deploy * Do not underline links in docs * shorter * cleanup docker images * tune nginx config * CLICKHOUSE-3043: get rid of habrastorage links * Lost translation * CLICKHOUSE-2936: temporary client-side redirect * behaves weird in test * put redirect back * CLICKHOUSE-3047: copy docs txts to public too * move to proper file * remove old pages to avoid confusion * Remove reference redirect warning for now * Refresh README.md * Yellow buttons in docs * Use svg flags instead of unicode ones in docs * fix test website instance * Put flags to separate files * wrong flag * Copy Yandex.Metrica introduction from main page to docs * Yet another home page structure change, couple new blocks (CLICKHOUSE-3045) * Update Contacts section * CLICKHOUSE-2849: more detailed legal information * CLICKHOUSE-2978 preparation - split by files * More changes in Contacts block * Tune texts on index page * update presentations * One more benchmark * Add usage sections to index page, adapted from slides * Get the roadmap started, based on slides from last ClickHouse Meetup * CLICKHOUSE-2977: some rendering tuning * Get rid of excessive section in the end of getting started * Make headers linkable * CLICKHOUSE-2981: links to editing reference - https://github.com/yandex/ClickHouse/issues/849 * CLICKHOUSE-2981: fix mobile styles in docs * Ban crawling of duplicating docs * Open some external links in new tab * Ban old docs too * Lots of trivial fixes in english docs * Lots of trivial fixes in russian docs * Remove getting started copies in markdown * Add Yandex.Webmaster * Fix some sphinx warnings * More warnings fixed in english docs * More sphinx warnings fixed * Add code-block:: text * More code-block:: text * These headers look not that well * Better switch between documentation languages * merge use_case.rst into ya_metrika_task.rst * Edit the agg_functions.rst texts * Add lost empty lines * Lost blank lines * Add new logo sizes * update presentations * Next step in migrating to new documentation * Fix all warnings in en reference * Fix all warnings in ru reference * Re-arrange existing reference * Move operation tips to main reference * Fix typos noticed by milovidov@ * Get rid of zookeeper.md * Looks like duplicate of tutorial.html * Fix some mess with html tags in tutorial * No idea why nobody noticed this before, but it was completely not clear whet to get the data * Match code block styling between main and tutorial pages (in favor of the latter) * Get rid of some copypaste in tutorial * Normalize header styles * Move example_datasets to sphinx * Move presentations submodule to website * Move and update README.md * No point in duplicating articles from habrahabr here * Move development-related docs as is for now * doc/reference/ -> docs/ (to match the URL on website) * Adapt links to match the previous commit * Adapt development docs to rst (still lacks translation and strikethrough support) * clean on release * blacklist presentations in gulp * strikethrough support in sphinx * just copy development folder for now * fix weird introduction in style article * Style guide translation (WIP) * Finish style guide translation to English * gulp clean separately * Update year in LICENSE * Initial CONTRIBUTING.md * Fix remaining links to old docs in tutorial * Some tutorial fixes * Typo * Another typo * Update list of authors from yandex-team accoding to git log
96 lines
4.1 KiB
ReStructuredText
96 lines
4.1 KiB
ReStructuredText
Quotas
|
|
======
|
|
|
|
Quotas allow you to limit resource usage over a period of time, or simply track the use of resources.
|
|
Quotas are set up in the user config. This is usually ``users.xml``.
|
|
|
|
The system also has a feature for limiting the complexity of a single query (see the section "Restrictions on query complexity").
|
|
|
|
In contrast to query complexity restrictions, quotas:
|
|
* place restrictions on a set of queries that can be run over a period of time, instead of limiting a single query.
|
|
* account for resources spent on all remote servers for distributed query processing.
|
|
|
|
Let's look at the section of the ``users.xml`` file that defines quotas.
|
|
|
|
.. code-block:: xml
|
|
|
|
<!-- Quotas. -->
|
|
<quotas>
|
|
<!-- Quota name. -->
|
|
<default>
|
|
<!-- Restrictions for a time period. You can set multiple time intervals with various restrictions. -->
|
|
<interval>
|
|
<!-- Length of time. -->
|
|
<duration>3600</duration>
|
|
|
|
<!-- No restrictions. Just collect data for the specified time interval. -->
|
|
<queries>0</queries>
|
|
<errors>0</errors>
|
|
<result_rows>0</result_rows>
|
|
<read_rows>0</read_rows>
|
|
<execution_time>0</execution_time>
|
|
</interval>
|
|
</default>
|
|
|
|
By default, the quota just tracks resource consumption for each hour, without limiting usage.
|
|
|
|
.. code-block:: xml
|
|
|
|
<statbox>
|
|
<!-- Restrictions for a time period. You can set multiple time intervals with various restrictions. -->
|
|
<interval>
|
|
<!-- Length of time.-->
|
|
<duration>3600</duration>
|
|
<queries>1000</queries>
|
|
<errors>100</errors>
|
|
<result_rows>1000000000</result_rows>
|
|
<read_rows>100000000000</read_rows>
|
|
<execution_time>900</execution_time>
|
|
</interval>
|
|
<interval>
|
|
<duration>86400</duration>
|
|
<queries>10000</queries>
|
|
<errors>1000</errors>
|
|
<result_rows>5000000000</result_rows>
|
|
<read_rows>500000000000</read_rows>
|
|
<execution_time>7200</execution_time>
|
|
</interval>
|
|
</statbox>
|
|
|
|
For the ``statbox`` quota, restrictions are set for every hour and for every 24 hours (86,400 seconds). The time interval is counted starting from an implementation-defined fixed moment in time. In other words, the 24-hour interval doesn't necessarily begin at midnight.
|
|
|
|
When the interval ends, all collected values are cleared. For the next hour, the quota calculation starts over.
|
|
|
|
Let's examine the amounts that can be restricted:
|
|
|
|
``queries`` - The overall number of queries.
|
|
|
|
``errors`` - The number of queries that threw exceptions.
|
|
|
|
``result_rows`` - The total number of rows output in results.
|
|
|
|
``read_rows`` - The total number of source rows retrieved from tables for running a query, on all remote servers.
|
|
|
|
``execution_time`` - The total time of query execution, in seconds (wall time).
|
|
|
|
If the limit is exceeded for at least one time interval, an exception is thrown with a text about which restriction was exceeded, for which interval, and when the new interval begins (when queries can be sent again).
|
|
|
|
Quotas can use the "quota key" feature in order to report on resources for multiple keys independently. Here is an example of this:
|
|
|
|
.. code-block:: xml
|
|
|
|
<!-- For the global report builder. -->
|
|
<web_global>
|
|
<!-- keyed - the quota_key "key" is passed in the query parameter, and the quota is tracked separately for each key value.
|
|
For example, you can pass a Metrica username as the key, so the quota will be counted separately for each username.
|
|
Using keys makes sense only if quota_key is transmitted by the program, not by a user.
|
|
You can also write <keyed_by_ip /> so the IP address is used as the quota key.
|
|
(But keep in mind that users can change the IPv6 address fairly easily.) -->
|
|
<keyed />
|
|
|
|
The quota is assigned to users in the ``users`` section of the config. See the section "Access rights".
|
|
|
|
For distributed query processing, the accumulated amounts are stored on the requestor server. So if the user goes to another server, the quota there will "start over".
|
|
|
|
When the server is restarted, quotas are reset.
|