Setting the Send Speed (Rate)

提供:FirstWiki
ナビゲーションに移動 検索に移動

多くの人が、所有も管理もしていないホストサーバーで phpList を実行しています。 これらは通常、共有ボックスです。つまり、1 台のコンピュータにたくさんの Web サイトがあります。 つまり、1 台のコンピュータにたくさんのウェブサイトがある状態です。 このため、1 つのウェブサイトが CPU を独占しようとしたり、コミュニティを意識しない、リソースを制限するような動作をしたりすると、全員が被害を受けます。

このため、ほとんどのホスティングプロバイダーは、1つのサイトが送信できる電子メールの数を制限しています。 1時間あたり、あるいは1日あたりのメール数を制限しているのです。 これはプロバイダーの仕事であり、ある人の利用がそのマシンの他のサイトに不必要な影響を与えないようにするためなのです。

また、プロバイダーがお客さまのメールリソースを制限する理由は、スパマーを受け入れたくないからということもあるかもしれません。 最初のメールを送る前に、ホスティングプロバイダに確認する必要があります。 聞いてみてください: 1日の制限はありますか?1時間ごとの制限はありますか?と聞いてみてください。 そして、config.phpファイルの次の設定を使用して、これらの制限の範囲内で安全に暮らせるようにします。

Limiting the speed rate

phpList では、1 時間あたり約 3000 個のパーソナライズされたメッセージ、または 1 時間あたり約 5000 個の非パーソナライズされたメッセージが送信されることになります。 ほとんどの共有ホスティングプロバイダーは、このメッセージ量を送信することを許可せず、1時間または1日の制限を課します。 phpList はこれらのメッセージ制限に対処する2つの方法を提供します:メールキューバッチ処理とメールキュースロットル処理です。 バッチ処理とスロットル処理のどちらを使うかは基本的に個人の好みですが、 PHP-cgi を実行しているサーバーではスロットル処理のほうが適しているかもしれません (PHP の 3 つのインターフェイスを参照)。

Mailqueue throttle

MAILQUEUE_THROTTLE は各メッセージの間に(秒単位で)休止時間を設けます(つまり、秒単位でメッセージを区切ります)。 この設定は、突然のメッセージ送信でサーバーに負荷がかかるのを避けるために使用できますが、バッチ処理の代わりとして使用することもできます。 例えば、メッセージの間隔を10秒にすると、実際には1時間に360通を超えるメッセージは送信されないことになります。

例:

# batch processing disabled:
define("MAILQUEUE_BATCH_SIZE",0);

# Batch_period is not effective when batch processing is disabled:
define("MAILQUEUE_BATCH_PERIOD",3600);

# Pause between messages (in seconds) to send no more than 360 messages per hour:
define('MAILQUEUE_THROTTLE',10);

Mailqueue batch processing

With batch processing, two primary settings work together to say: Send no more than N emails every T seconds. Where: N is MAILQUEUE_BATCH_SIZE T is MAILQUEUE_BATCH_PERIOD These settings force phpList to "restrain itself" and avoid sending out all messages in one go.

So, say you have an hourly limit of 400 emails. Should you set the batch size to 400? No! Why? What about other emails, such as confirmation requests, system messages, or emails sent by other applications you might have running on this site?

No, you want to back away from that "400", which is a best case scenario. Instead, give yourself some safe breathing room. For example, if you get 24 new sign-ups a day then you should subtract 5 or so to be safe, thus 395. Running other software that sends notifications? back it down. A comfortable number for a small installation would be 20-40 down from your hourly limit.

Example: バッチ処理では、主に2つの設定が連動して言います: T秒ごとにN通以上のメールを送信しない。 ここで N は MAILQUEUE_BATCH_SIZE、 T は MAILQUEUE_BATCH_PERIOD これらの設定は、phpList に「自制」させ、すべてのメッセージを一度に送信することを避けるようにします。

例えば、1時間に400通のメール送信を制限しているとします。バッチサイズを400に設定する必要があるでしょうか?いいえ!なぜですか?他のメール、例えば確認要求やシステムメッセージ、このサイトで動作させている他のアプリケーションから送信されるメールなどはどうでしょうか?

いいえ、その「400」からは遠ざかりたいものです。その代わり、安全な余裕を持たせてください。 例えば、1日に24件の新規登録があった場合、5件ほど差し引くと395件となり、安全です。 他のソフトウェアで通知を送る場合は、この値を下げてください。 小規模なインストールであれば、1時間あたりの上限から20~40程度下げるのが快適な数字です。

例:

# Send a batch of 360 messages per batch period:
define("MAILQUEUE_BATCH_SIZE",360);

# batch period is set to 3600 seconds (=1 hour):
define("MAILQUEUE_BATCH_PERIOD",3600);

# Pause between messages (in seconds) to avoid overloading the server:
define('MAILQUEUE_THROTTLE',1);

サーバーがPHP-cgiを実行している場合、タイムアウトの問題があるかもしれません(The three interfaces op PHPを参照)。その場合、例えば10分という短いバッチ期間を試してみてください。

Example:

# Send a batch of 60 messages per batch period:
define("MAILQUEUE_BATCH_SIZE",60);

# batch period is set to 600 seconds (= 10 minutes):
define("MAILQUEUE_BATCH_PERIOD",600);

# Pause between messages (in seconds) to avoid overloading the server:
define('MAILQUEUE_THROTTLE',1);

メッセージキューを手動で処理する場合、つまりブラウザを使用する場合は、10個のメッセージを送信した後、ブラウザをリロードして次の10個を送信するような、小さなバッチと短いバッチ期間を使用する設定を検討するとよいでしょう。ただし、これは送信を制限するものではないので、ISPの制限を超える可能性が高いです。

Example:

# define("MAILQUEUE_BATCH_SIZE",10);
# define("MAILQUEUE_BATCH_PERIOD",1);

config.phpの該当箇所

config.php

# batch processing
# batch processing
# if you are on a shared host, it will probably be appreciated if you don't send
# out loads of emails in one go. To do this, you can configure batch processing.
# Please note, the following two values can be overridden by your ISP by using
# a server wide configuration. So if you notice these values to be different
# in reality, that may be the case

## if you send the queue using your browser, you may want to consider settings like this
## which will send 10 messages and then reload the browser to send the next 10. However, this
## will not restrict the sending to any limits, so there's a good chance you will
## go over the limits of your ISP
# define("MAILQUEUE_BATCH_SIZE",10);
# define("MAILQUEUE_BATCH_PERIOD",1);

## if you send the queue using commandline, you can set it to something that complies with the
## limits of your ISP, eg 300 messages an hour would be
# define("MAILQUEUE_BATCH_SIZE",300);
# define("MAILQUEUE_BATCH_PERIOD",3600);
# and then you need to set the cron to run every 5 minutes

# define the amount of emails you want to send per period. If 0, batch processing
# is disabled and messages are sent out as fast as possible
define("MAILQUEUE_BATCH_SIZE",0);

# define the length of one batch processing period, in seconds (3600 is an hour)
# Please note: this setting has two consequences:
# 1. it will enforce that the amount of emails sent in the period identified here does not exceed the amount
#  set in MAILQUEUE_BATCH_SIZE
# 2. there will be a delay of MAILQUEUE_BATCH_PERIOD when running the queue.
#
# number 1 is mostly when using commandline queue processing (strongly recommended)
# number 2 is when using browser queue processing. The browser will reload to send the next
# batch after the amount of seconds set here

define("MAILQUEUE_BATCH_PERIOD",100);

# to avoid overloading the server that sends your email, you can add a little delay
# between messages that will spread the load of sending
# you will need to find a good value for your own server
# value is in seconds (or you can play with the autothrottle below)
define('MAILQUEUE_THROTTLE',0);

Experimental settings: auto throttle and domain throttle

# Mailqueue autothrottle. This will try to automatically change the delay
# between messages to make sure that the MAILQUEUE_BATCH_SIZE (above) is spread evently over
# MAILQUEUE_BATCH_PERIOD, instead of firing the Batch in the first few minutes of the period
# and then waiting for the next period. This only works with mailqueue_throttle off
# it still needs tweaking, so send your feedback to mantis.tincan.co.uk if you find
# any issues with it
define('MAILQUEUE_AUTOTHROTTLE',0);

# Domain Throttling
# You can activate domain throttling, by setting USE_DOMAIN_THROTTLE to 1
# define the maximum amount of emails you want to allow sending to any domain and the number
# of seconds for that amount. This will make sure you don't send too many emails to one domain
# which may cause blacklisting. Particularly the big ones are tricky about this.
# it may cause a dramatic increase in the amount of time to send a message, depending on how
# many users you have that have the same domain (eg hotmail.com)
# if too many failures for throttling occur, the send process will automatically add an extra
# delay to try to improve that. The example sends 1 message every 2 minutes.

define('USE_DOMAIN_THROTTLE',0);
define('DOMAIN_BATCH_SIZE',1);
define('DOMAIN_BATCH_PERIOD',120);

Tips & tricks from the forum