Updating Throttle Settings in SQL
This page describes how to update GreenArrow Engine’s throttling configuration via PostgreSQL database queries.
To update throttle settings via a web interface, see the Throttling page.
To update non-throttling IP address settings via PostgreSQL queries, see the Bulk Update IP Address Settings in Database page.
Throttle Rules for IP Addresses
Each IP address can have throttle override rules. These rules take precedence over the Throttle Template that’s selected for the IP address. See the Throttling page for more details on precedence.
mr_ipaddr_perdomain Table Schema
The rules for each IP address are stored in the mr_ipaddr_perdomain
table:
Column | Type | Modifiers
---------------------+-------------------+---------------------------------------------------------------------------------
id | integer | not null default nextval('mr_ipaddr_and_ttemplate__perdomain_id_seq'::regclass)
mr_ipaddr_id | integer | not null
domains | character varying | not null
maxconn | integer | not null
msgperhour | integer | not null
backlog | integer |
as_group | integer | not null
throttle_program_id | integer |
backlog_disk | integer |
You can ignore the as_group
, backlog
, and backlog_disk
columns. Leave them set to 1
, NULL
, and NULL
respectively unless directed by GreenArrow technical support.
Looking up Override Rules for IPs
If you know the id
of the IP address’ VirtualMTA, run this query:
SELECT * FROM mr_ipaddr_perdomain WHERE mr_ipaddr_id = 1234 ORDER BY domains;
If you only know the name of the IP address’ VirtualMTA, run this query:
SELECT * FROM mr_ipaddr_perdomain WHERE mr_ipaddr_id = ( SELECT id FROM mr_ipaddr WHERE name = 'smtp1-1' ) ORDER BY domains;
Example output:
id | mr_ipaddr_id | domains | maxconn | msgperhour | backlog | as_group | throttle_program_id | backlog_disk
-----+--------------+---------+---------+------------+---------+----------+-----------------------------------
140 | 3 | aol.com | 60 | 0 | | 1 | |
Creating Override Rules
INSERT INTO mr_ipaddr_perdomain ( mr_ipaddr_id, domains, maxconn, msgperhour, as_group ) VALUES ( 1234, 'yahoo.com,rocketmail.com,yahoo.co.uk', 10, 3000, 1 );
You can’t have the same domain name in multiple override rules. For example the second query in this sequence is no longer valid after the first query is run:
INSERT INTO mr_ipaddr_perdomain ( mr_ipaddr_id, domains, maxconn, msgperhour, as_group ) VALUES ( 1234, 'yahoo.com,rocketmail.com,yahoo.co.uk', 10, 3000, 1 );
INSERT INTO mr_ipaddr_perdomain ( mr_ipaddr_id, domains, maxconn, msgperhour, as_group ) VALUES ( 1234, 'yahoo.com', 10, 3000, 1 );
The second query will produce the following error:
ERROR: unique violation for domain in mr_ipaddr_perdomain: id=(7) domain=(yahoo.com)
Don’t worry about updating the mr_ipaddr_perdomain__domain
table. It is automatically updated by triggers and used to enforce the above constraint.
Throttle Setting for Domains without Rules
For any domain that is not specified in the throttle template (mr_ttemplate_perdomain
) table or in an override rule for the IP address in question (mr_ipaddr_perdomain
table), the default throttle limits from the mr_ipaddr
table are used (mr_ipaddr.maxconn
and mr_ipaddr.msgperhour
). If these values are NULL
, then the default values are taken from mr_ttemplate.maxconn
and mr_ttemplate.msgperhour
.
Throttle Template
Throttle template rules are inherited by sending IP addresses unless a matching throttle override rule is configured.
The per-domain rules for the throttle template are stored in the mr_ttemplate_perdomain
table.
mr_ttemplate_perdomain Table Schema
Column | Type | Modifiers
---------------------+-------------------+---------------------------------------------------------------------------------
id | integer | not null default nextval('mr_ipaddr_and_ttemplate__perdomain_id_seq'::regclass)
mr_ttemplate_id | integer | not null
domains | character varying | not null
maxconn | integer | not null
msgperhour | integer | not null
backlog | integer |
as_group | integer | not null
throttle_program_id | integer |
backlog_disk | integer |
The mr_ttemplate_id
column is set equal to the id
of the Throttle Template that the rule is applied to.
Viewing Throttle Template Rules
To view the current throttle template rules, run:
SELECT * FROM mr_ttemplate_perdomain;
Here’s some example output:
id | mr_ttemplate_id | domains | maxconn | msgperhour | backlog | as_group | throttle_program_id | backlog_disk
-----+-----------------+--------------------------------+---------+------------+---------+----------+-----------------------------------
121 | 1 | nolimit.discardallmail.drh.net | 1000 | 0 | | 1 | |
122 | 1 | yahoo.com | 150 | 0 | | 1 | |
123 | 1 | hotmail.com | 40 | 0 | | 1 | |
124 | 1 | msn.com | 40 | 0 | | 1 | |
125 | 1 | sympatico.ca | 40 | 0 | | 1 | |
126 | 1 | comcast.net | 12 | 0 | | 1 | |
127 | 1 | optonline.com | 5 | 0 | | 1 | |
128 | 1 | excite.com | 20 | 6000 | | 1 | |
129 | 1 | bellsouth.net | 10 | 0 | | 1 | |
130 | 1 | cox.net | 15 | 0 | | 1 | |
131 | 1 | aol.com | 120 | 0 | | 1 | |
132 | 1 | sbcglobal.net | 40 | 0 | | 1 | |
133 | 1 | gmail.com | 40 | 0 | | 1 | |
134 | 1 | netscape.net | 40 | 0 | | 1 | |
135 | 1 | earthlink.net | 40 | 0 | | 1 | |
136 | 1 | verizon.net | 40 | 0 | | 1 | |
137 | 1 | mac.com | 40 | 0 | | 1 | |
138 | 1 | usa.net | 40 | 0 | | 1 | |
139 | 1 | worldnet.att.net | 40 | 0 | | 1 | |
Creating Throttle Template Rules
INSERT INTO mr_ttemplate_perdomain ( mr_ttemplate_id, domains, maxconn, msgperhour, as_group ) VALUES ( 1234, 'yahoo.com,rocketmail.com,yahoo.co.uk', 10, 3000, 1 );
You cannot create multiple entries for the same domain / Throttle Template id
combination in this table.
Updating Throttle Template Rules
To update the Throttle Template Rules for gmail.com to allow for up to 60 concurrent SMTP connections, run:
UPDATE mr_ttemplate_perdomain SET maxconn = 60 WHERE domains = 'gmail.com';
Default Settings for Domains Not Specified
The settings for any domains not specified (analogous to mr_ipaddr.maxconn
and mr_ipaddr.msgperhour
) are stored in the mr_ttemplate
table:
Column | Type | Modifiers
--------------+-------------------+-----------------------------------------------------------
id | integer | not null default nextval('mr_ttemplate_id_seq'::regclass)
maxconn | integer | not null
msgperhour | integer |
backlog | integer |
name | character varying | not null
backlog_disk | integer |
This table may only contain one row per Throttle Template. Only issue UPDATE
queries against this table.
For example:
UPDATE mr_ttemplate SET maxconn = 20, msgperhour = 0 WHERE id = 1;