[hornetq-commits] JBoss hornetq SVN: r9079 - branches/HnetQ_323_cn/docs/user-manual/zh.
do-not-reply at jboss.org
do-not-reply at jboss.org
Thu Apr 8 11:19:33 EDT 2010
Author: gaohoward
Date: 2010-04-08 11:19:33 -0400 (Thu, 08 Apr 2010)
New Revision: 9079
Modified:
branches/HnetQ_323_cn/docs/user-manual/zh/large-messages.xml
branches/HnetQ_323_cn/docs/user-manual/zh/paging.xml
Log:
done
Modified: branches/HnetQ_323_cn/docs/user-manual/zh/large-messages.xml
===================================================================
--- branches/HnetQ_323_cn/docs/user-manual/zh/large-messages.xml 2010-04-08 11:36:44 UTC (rev 9078)
+++ branches/HnetQ_323_cn/docs/user-manual/zh/large-messages.xml 2010-04-08 15:19:33 UTC (rev 9079)
@@ -17,29 +17,20 @@
<!-- permitted by applicable law. -->
<!-- ============================================================================= -->
<chapter id="large-messages">
- <title>Large Messages</title>
- <para>HornetQ supports sending and receiving of huge messages, even when the client and server
- are running with limited memory. The only realistic limit to the size of a message that can
- be sent or consumed is the amount of disk space you have available. We have tested sending
- and consuming messages up to 8 GiB in size with a client and server running in just 50MiB of
- RAM!</para>
- <para>To send a large message, the user can set an <literal>InputStream</literal> on a message
- body, and when that message is sent, HornetQ will read the <literal>InputStream</literal>. A
- <literal>FileInputStream</literal> could be used for example to send a huge message from
- a huge file on disk.</para>
- <para>As the <literal>InputStream</literal> is read the data is sent to the server as a stream
- of fragments. The server persists these fragments to disk as it receives them and when the
- time comes to deliver them to a consumer they are read back of the disk, also in fragments
- and sent down the wire. When the consumer receives a large message it initially receives
- just the message with an empty body, it can then set an <literal>OutputStream</literal> on
- the message to stream the huge message body to a file on disk or elsewhere. At no time is
- the entire message body stored fully in memory, either on the client or the server.</para>
+ <title>大消息</title>
+ <para>HornetQ支持超大消息的发送和接收。消息的大小不受客户端或服务器端的内存限制。它只受限于你的磁盘空间的大小。
+ 在我们作过的测试中,消息最大可达8GiB,而客户端和服务器端的内存只有50MiB!</para>
+ <para>要发送一个大消息,用户需要为大消息提供一个<literal>InputStream</literal>,当大消息被发送时,
+ HornetQ从该<literal>InputStream</literal>读取消息。例如,要将一个磁盘中的大文件以消息形式发送,可以
+ 使用<literal>FileInputStream</literal>。</para>
+ <para>数据从<literal>InputStream</literal>读出并分解为一个个数据片段向服务器以流的形式发送。服务器在收到
+ 这些片段后将它们保存到磁盘上。当服务器准备向接收者传递消息时,它将这些片段读回,同样以片段流的形式向接收者
+ 一端发送。当接收者开始接收时,最初收到的只是一个空的消息体。它需要为其设置一个<literal>OutputStream</literal>
+ 以便向大消息保存到磁盘上或其它地方。从发送到接收整个过程中不需要整个消息都在内存中。</para>
<section id="large.message.configuring">
- <title>Configuring the server</title>
- <para>Large messages are stored on a disk directory on the server side, as configured on the
- main configuration file.</para>
- <para>The configuration property <literal>large-messages-directory</literal> specifies where
- large messages are stored.</para>
+ <title>服务器端的配置</title>
+ <para>大消息在服务器端是直接保存在磁盘目录中。这一目录可以在HornetQ的配置文件中定义。</para>
+ <para>这个参数的名字是<literal>large-messages-directory</literal>:</para>
<programlisting><configuration xmlns="urn:hornetq"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:hornetq /schema/hornetq-configuration.xsd">
@@ -51,31 +42,29 @@
...
</configuration</programlisting>
- <para>By default the large message directory is <literal>data/largemessages</literal></para>
- <para>For the best performance we recommend large messages directory is stored on a
- different physical volume to the message journal or paging directory.</para>
+ <para>默认的大消息保存目录是<literal>data/largemessages</literal>。</para>
+ <para>为了提高性能,我们建议将大消息的保存目录定义到与消息日志(journal)或分页转存目录分开的物理卷上。</para>
</section>
<section>
- <title>Setting the limits</title>
- <para>Any message large than a certain size is considered a large message. Large messages
- will be split up and sent in fragments. This is determined by the parameter <literal
- >min-large-message-size</literal></para>
- <para>The default value is 100KiB.</para>
+ <title>设定限制</title>
+ <para>参数<literal>min-large-message-size</literal>定义了大消息的最小值。
+ 任何消息的大小如果超过了该值就被视为大消息。一旦成为大消息,它将被分成小的
+ 片段来传送。</para>
+ <para>默认值是100KiB.</para>
<section id="large-messages.core.config">
- <title>Using Core API</title>
- <para>If the HornetQ Core API is used, the minimal large message size is specified by
- <literal>ClientSessionFactory.setMinLargeMessageSize</literal>.</para>
+ <title>使用核心的API</title>
+ <para>如果使用HornetQ的核心,<literal>ClientSessionFactory.setMinLargeMessageSize</literal>方法
+ 可以设置大消息的最小值。</para>
<programlisting>ClientSessionFactory factory =
HornetQClient.createClientSessionFactory(new
TransportConfiguration(NettyConnectorFactory.class.getName()), null);
factory.setMinLargeMessageSize(25 * 1024);</programlisting>
- <para><xref linkend="configuring-transports.client.side"/> will provide more information
- on how to instantiate the session factory.</para>
+ <para><xref linkend="configuring-transports.client.side"/>对于如何实例化一个会话工厂(session factory)
+ 给出了进一步的说明。</para>
</section>
<section>
- <title>Using JMS</title>
- <para>If JNDI is used to look up the connection factory, the minimum large message size
- is specified in <literal>hornetq-jms.xml</literal></para>
+ <title>使用JMS</title>
+ <para>如果连接工厂是通过JNDI方式获得的,则需要在<literal>hornetq-jms.xml</literal>文件中定义:</para>
<programlisting>...
<connection-factory name="ConnectionFactory">
<connectors>
@@ -89,34 +78,26 @@
<min-large-message-size>250000</min-large-message-size>
</connection-factory>
...</programlisting>
- <para>If the connection factory is being instantiated directly, the minimum large
- message size is specified by <literal
- >HornetQConnectionFactory.setMinLargeMessageSize</literal>.</para>
+ <para>如果是直接实例化连接工厂,则使用<literal
+ >HornetQConnectionFactory.setMinLargeMessageSize</literal>方法来定义。</para>
</section>
</section>
<section>
- <title>Streaming large messages</title>
- <para>HornetQ supports setting the body of messages using input and output streams (<literal
- >java.lang.io</literal>)</para>
- <para>These streams are then used directly for sending (input streams) and receiving (output
- streams) messages.</para>
- <para>When receiving messages there are 2 ways to deal with the output stream; you may
- choose to block while the output stream is recovered using the method <literal
- >ClientMessage.saveOutputStream</literal> or alternatively using the method <literal
- >ClientMessage.setOutputstream</literal> which will asynchronously write the message
- to the stream. If you choose the latter the consumer must be kept alive until the
- message has been fully received.</para>
- <para>You can use any kind of stream you like. The most common use case is to send files
- stored in your disk, but you could also send things like JDBC Blobs, <literal
- >SocketInputStream</literal>, things you recovered from <literal
- >HTTPRequests</literal> etc. Anything as long as it implements <literal
- >java.io.InputStream</literal> for sending messages or <literal
- >java.io.OutputStream</literal> for receiving them.</para>
+ <title>大消息与流(stream)</title>
+ <para>在HornetQ中可以定义大消息所使用的输入和输出流(<literal>java.lang.io</literal>)。</para>
+ <para>HornetQ将使用定义的流来发送(输入流)和接收(输出流)大消息。</para>
+ <para>在使用输出流接收大消息时,有两种选择:你可以用<literal>ClientMessage.saveOutputStream</literal>方法
+ 以阻塞的方式保存大消息;或者你可以使用<literal>ClientMessage.setOutputstream</literal>方法
+ 以异步方法保存大消息。在采用后一种方法时,必须保证接收者(consumer)在大消息的接收过程中保持
+ 有效状态。</para>
+ <para>根据需要选择所适合的流。最常见的情况是将磁盘文件以消息方式发送,也有可能是JDBC的Blob数据,
+ 或者是一个<literal>SocketInputStream</literal>,或是来自<literal>HTTPRequests</literal>
+ 的数据等等。只要是实现了<literal>java.io.InputStream</literal>和
+ <literal>java.io.OutputStream</literal>的数据源都可以作为大消息传送。</para>
<section>
- <title>Streaming over Core API</title>
- <para>The following table shows a list of methods available at <literal
- >ClientMessage</literal> which are also available through JMS by the use of
- object properties.</para>
+ <title>核心API中流的使用</title>
+ <para>下表列出了<literal>ClientMessage</literal>上可以使用的方法。
+ 通过相应的对象属性也可以在JMS中应用。</para>
<table frame="topbot" id="large-messages.ClientMessageAPI">
<title>org.hornetq.api.core.client.ClientMessage API</title>
<tgroup cols="3">
@@ -125,35 +106,32 @@
<colspec colname="JMS" colnum="3"/>
<thead>
<row>
- <entry>Name</entry>
- <entry>Description</entry>
- <entry>JMS Equivalent Property</entry>
+ <entry>名称</entry>
+ <entry>说明</entry>
+ <entry>JMS相对应的属性</entry>
</row>
</thead>
<tbody>
<row>
<entry>setBodyInputStream(InputStream)</entry>
- <entry>Set the InputStream used to read a message body when sending
- it.</entry>
+ <entry>设定大消息发送时所使用的输入流。</entry>
<entry>JMS_HQ_InputStream</entry>
</row>
<row>
<entry>setOutputStream(OutputStream)</entry>
- <entry>Set the OutputStream that will receive the body of a message.
- This method does not block.</entry>
+ <entry>设定异步接收大消息所使用的输出流。</entry>
<entry>JMS_HQ_OutputStream</entry>
</row>
<row>
<entry>saveOutputStream(OutputStream)</entry>
- <entry>Save the body of the message to the <literal
- >OutputStream</literal>. It will block until the entire content
- is transferred to the <literal>OutputStream</literal>.</entry>
+ <entry>设定保存大消息所使用的输出流。这个方法将会阻塞直到大消息全部
+ 保存完毕才返回。</entry>
<entry>JMS_HQ_SaveStream</entry>
</row>
</tbody>
</tgroup>
</table>
- <para>To set the output stream when receiving a core message: </para>
+ <para>下面代码中设定了接收核心消息所用的输出流: </para>
<programlisting>
...
ClientMessage msg = consumer.receive(...);
@@ -169,7 +147,7 @@
...
</programlisting>
- <para> Set the input stream when sending a core message: </para>
+ <para> 设定发送核心消息所用的输入流: </para>
<programlisting>
...
ClientMessage msg = session.createMessage();
@@ -178,13 +156,11 @@
</programlisting>
</section>
<section id="large-messages.streaming.over.jms">
- <title>Streaming over JMS</title>
- <para>When using JMS, HornetQ maps the streaming methods on the core API (see <xref
- linkend="large-messages.ClientMessageAPI"/>) by setting object properties . You
- can use the method <literal>Message.setObjectProperty</literal> to set the input and
- output streams.</para>
- <para>The <literal>InputStream</literal> can be defined through the JMS Object Property
- JMS_HQ_InputStream on messages being sent:</para>
+ <title>在JMS中使用流</title>
+ <para>使用JMS时,HornetQ根据定义的属性值调用对应的核心接口(参见 <xref
+ linkend="large-messages.ClientMessageAPI"/>)来使用流。你只需要用
+ <literal>Message.setObjectProperty</literal>方法设置适当的输入/输出流即可。</para>
+ <para>输入流<literal>InputStream</literal>可以通过JMS属性JMS_HQ_InputStream来定义:</para>
<programlisting>
BytesMessage message = session.createBytesMessage();
@@ -195,8 +171,7 @@
message.setObjectProperty("JMS_HQ_InputStream", bufferedInput);
someProducer.send(message);</programlisting>
- <para>The <literal>OutputStream</literal> can be set through the JMS Object Property
- JMS_HQ_SaveStream on messages being received in a blocking way.</para>
+ <para>输出流<literal>OutputStream</literal>可以通过JMS属性JMS_HQ_SaveStream来定义。下面是阻塞式方法:</para>
<programlisting>
BytesMessage messageReceived = (BytesMessage)messageConsumer.receive(120000);
@@ -209,24 +184,20 @@
// This will block until the entire content is saved on disk
messageReceived.setObjectProperty("JMS_HQ_SaveStream", bufferedOutput);
</programlisting>
- <para>Setting the <literal>OutputStream</literal> could also be done in a non blocking
- way using the property JMS_HQ_OutputStream.</para>
+ <para>也可以使用JMS_HQ_OutputStream属性以非阻塞式(异步)方法来定义输出流<literal>OutputStream</literal>:</para>
<programlisting>
// This won't wait the stream to finish. You need to keep the consumer active.
messageReceived.setObjectProperty("JMS_HQ_OutputStream", bufferedOutput);
</programlisting>
<note>
- <para>When using JMS, Streaming large messages are only supported on <literal
- >StreamMessage</literal> and <literal>BytesMessage</literal>.</para>
+ <para>使用JMS时,只有<literal>StreamMessage</literal>和<literal>BytesMessage</literal>才支持大消息的传送。</para>
</note>
</section>
</section>
<section>
- <title>Streaming Alternative</title>
- <para>If you choose not to use the <literal>InputStream</literal> or <literal
- >OutputStream</literal> capability of HornetQ You could still access the data
- directly in an alternative fashion.</para>
- <para>On the Core API just get the bytes of the body as you normally would.</para>
+ <title>不使用流的方式</title>
+ <para>如果不想使用输入流与输出流来传送大消息,可以用另外一种方法。</para>
+ <para>使用核心接口时,可以直接从消息中读字节。</para>
<programlisting>ClientMessage msg = consumer.receive();
byte[] bytes = new byte[1024];
@@ -235,8 +206,8 @@
msg.getBody().readBytes(bytes);
// Whatever you want to do with the bytes
}</programlisting>
- <para>If using JMS API, <literal>BytesMessage</literal> and <literal>StreamMessage</literal>
- also supports it transparently.</para>
+ <para>使用JMS接口时,<literal>BytesMessage</literal>和<literal>StreamMessage</literal>
+ 本身提供这样的支持。</para>
<programlisting>BytesMessage rm = (BytesMessage)cons.receive(10000);
byte data[] = new byte[1024];
@@ -248,22 +219,16 @@
} </programlisting>
</section>
<section id="large-messages.cache.client">
- <title>Cache Large Messages on client</title>
- <para>LargeMessages are transferred by streaming from server to client. The message is
- broken into smaller packets and as the message is read more packets will be received.
- Because of that the body of the large message can be read only once, and by consequence
- a received message can be sent to another producer only once. The JMS Bridge for
- instance won't be able to resend a large message in case of failure</para>
- <para>To solve this problem, you can enable the property <literal
- >cache-large-message-client</literal> on the connection factory. If you enable this
- property the client consumer will create a temporary file to hold the large message
- content, so it would be possible to resend large messages.</para>
- <note>Use this option on the connection factory used by the JMS Bridge if the JMS Bridge is
- being used for large messages.</note>
+ <title>在客户端缓存大消息</title>
+ <para>大消息通过流在服务器和客户端之间传输。每个大消息被分割成很多小的数据包传递。因此大消息只能被
+ 读取一次。这样一个大消息在收到后就不能再被再次传送。例如,JMS Bridge在发送大消息时如果在出现故障,
+ 将不能把它重新发送。</para>
+ <para>要解决这个问题,可以在连接工厂上设置<literal>cache-large-message-client</literal>属性。
+ 这个属性可以使客户端接收者创建一个临时的文件保存收到的大消息,这样就可以在需要时能够重新发送该消息。</para>
+ <note>如果JMS Bridge用来发送大消息,可以在它使用的连接工厂上使用它。</note>
</section>
<section id="large-messages.example">
- <title>Large message example</title>
- <para>Please see <xref linkend="examples.large-message"/> for an example which shows how
- large message is configured and used with JMS.</para>
+ <title>大消息例子</title>
+ <para>我们在<xref linkend="examples.large-message"/>提供了一个在JMS中配置和使用大消息的例子。</para>
</section>
</chapter>
Modified: branches/HnetQ_323_cn/docs/user-manual/zh/paging.xml
===================================================================
--- branches/HnetQ_323_cn/docs/user-manual/zh/paging.xml 2010-04-08 11:36:44 UTC (rev 9078)
+++ branches/HnetQ_323_cn/docs/user-manual/zh/paging.xml 2010-04-08 15:19:33 UTC (rev 9079)
@@ -17,29 +17,25 @@
<!-- permitted by applicable law. -->
<!-- ============================================================================= -->
<chapter id="paging">
- <title>Paging</title>
- <para>HornetQ transparently supports huge queues containing millions of messages while the
- server is running with limited memory.</para>
- <para>In such a situation it's not possible to store all of the queues in memory at any one
- time, so HornetQ transparently <emphasis>pages</emphasis> messages into and out of memory as
- they are needed, thus allowing massive queues with a low memory footprint.</para>
- <para>HornetQ will start paging messages to disk, when the size of all messages in memory for an
- address exceeds a configured maximum size.</para>
- <para>By default, HornetQ does not page messages - this must be explicitly configured to
- activate it.</para>
+ <title>分页转存</title>
+ <para>HornetQ可以在有限的内存下支持包含百万消息的超大规模的队列。</para>
+ <para>当有限的内存无法装得下如此多的消息时,HornetQ将它们<emphasis>分页转存</emphasis>到磁盘中,在内存
+ 有空闲时再将消息分页装载到内存。通过这样的处理,不需要服务器有很大的内存就可以支持大容量的队列。</para>
+ <para>通过配置可以给一个地址设置一个最大消息值。当这个地址消息数在内存中超过了这个值时,HornetQ开始将多余的消息
+ 转存到磁盘中。</para>
+ <para>默认情况下HornetQ不转存任何消息。这一功能必须显式地通过配置来激活。</para>
<section>
- <title>Page Files</title>
- <para>Messages are stored per address on the file system. Each address has an individual
- folder where messages are stored in multiple files (page files). Each file will contain
- messages up to a max configured size (<literal>page-size-bytes</literal>). When reading
- page-files all messages on the page-file are read, routed and the file is deleted as
- soon as the messages are recovered.</para>
+ <title>分页文件</title>
+ <para>消息按照所属的地址分别保存在不同的文件中。每一个地址有一个单独的文件夹,每个文件夹内消息被保存在
+ 数个文件中(分页文件)。每个文件保存固定数量的消息(由参数<literal>page-size-bytes</literal>
+ 设定)。当从分页文件中读取消息时,一个文件的所有消息被读到内存并被路由。当所有消息处理后,该文件就
+ 被删除。</para>
</section>
<section id="paging.main.config">
- <title>Configuration</title>
- <para>You can configure the location of the paging folder</para>
- <para>Global paging parameters are specified on the main configuration file (<literal
- >hornetq-configuration.xml</literal>).</para>
+ <title>配置</title>
+ <para>你可以配置分页转存文件夹的位置。</para>
+ <para>在主配置文件<literal>hornetq-configuration.xml</literal>)中
+ 可以定义全局的分页转发参数。</para>
<programlisting><configuration xmlns="urn:hornetq"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:hornetq /schema/hornetq-configuration.xsd">
@@ -51,23 +47,22 @@
... </programlisting>
<para>
<table frame="topbot">
- <title>Paging Configuration Parameters</title>
+ <title>分页转存的配置参数</title>
<tgroup cols="3">
<colspec colname="c1" colnum="1"/>
<colspec colname="c2" colnum="2"/>
<colspec colname="c3" colnum="3"/>
<thead>
<row>
- <entry>Property Name</entry>
- <entry>Description</entry>
- <entry>Default</entry>
+ <entry>参数名</entry>
+ <entry>说明</entry>
+ <entry>默认值</entry>
</row>
</thead>
<tbody>
<row>
<entry><literal>paging-directory</literal></entry>
- <entry>Where page files are stored. HornetQ will create one folder for
- each address being paged under this configured location.</entry>
+ <entry>分页转存文件的位置。HornetQ在这个位置下为每个地址建立一个文件夹。</entry>
<entry>data/paging</entry>
</row>
</tbody>
@@ -77,13 +72,12 @@
</section>
<section id="paging.mode">
- <title>Paging Mode</title>
- <para>As soon as messages delivered to an address exceed the configured size, that address
- alone goes into page mode.</para>
+ <title>分页转存模式</title>
+ <para>一个地址只要消息的数量超过定义的值,它就转到分页转存的模式。</para>
<section>
- <title>Configuration</title>
- <para>Configuration is done at the address settings, done at the main configuration file
- (<literal>hornetq-configuration.xml</literal>).</para>
+ <title>配置</title>
+ <para>有关分页转存的配置在主要配置文件(<literal>hornetq-configuration.xml</literal>)
+ 的地址设置的部分内。</para>
<programlisting> <address-settings>
<address-setting match="jms.someaddress">
<max-size-bytes>104857600</max-size-bytes>
@@ -92,40 +86,37 @@
</address-setting>
</address-settings>
</programlisting>
- <para>This is the list of available parameters on the address settings.</para>
+ <para>下面列出了可用的参数:</para>
<para>
<table frame="topbot">
- <title>Paging Address Settings</title>
+ <title>分页转存参数设置</title>
<tgroup cols="3">
<colspec colname="c1" colnum="1"/>
<colspec colname="c2" colnum="2"/>
<colspec colname="c3" colnum="3"/>
<thead>
<row>
- <entry>Property Name</entry>
- <entry>Description</entry>
- <entry>Default</entry>
+ <entry>参数名称</entry>
+ <entry>说明</entry>
+ <entry>默认值</entry>
</row>
</thead>
<tbody>
<row>
<entry><literal>max-size-bytes</literal></entry>
- <entry>What's the max memory the address could have before entering
- on page mode.</entry>
- <entry>-1 (disabled)</entry>
+ <entry>地址的最大内存值。当消息占用内存超过此值时,进入分页转存模式。</entry>
+ <entry>-1 (关闭分页转存功能)</entry>
</row>
<row>
<entry><literal>page-size-bytes</literal></entry>
- <entry>The size of each page file used on the paging system</entry>
- <entry>10MiB (10 * 1024 * 1024 bytes)</entry>
+ <entry>每个分页文件的大小。</entry>
+ <entry>10MiB (10 * 1024 * 1024 字节)</entry>
</row>
<row>
<entry><literal>address-full-message-policy</literal></entry>
- <entry>This must be set to PAGE for paging to enable. If the value
- is PAGE then further messages will be paged to disk. If the
- value is DROP then further messages will be silently dropped. If
- the value is BLOCK then client message producers will block when
- they try and send further messages.</entry>
+ <entry>要使用分页转存,这个参数必须设为PAGE。PAGE表示多余的消息会被保存到磁盘。
+ 如果设为DROP,那么多余的消息将会被丢弃。如果设为BLOCK,当消息占满设定的最大
+ 内存时,在客户端消息的发送者将被阻塞,不能向服务器发送更多的消息。</entry>
<entry>PAGE</entry>
</row>
</tbody>
@@ -135,79 +126,69 @@
</section>
</section>
<section>
- <title>Dropping messages</title>
- <para>Instead of paging messages when the max size is reached, an address can also be configured to just drop messages when the address
- is full.</para>
- <para>To do this just set the <literal>address-full-policy</literal> to <literal>DROP</literal> in the address settings</para>
+ <title>丢弃消息</title>
+ <para>一个地址除了可以分页转存多余的消息外,还可以配置为丢弃多余消息。</para>
+ <para>只要将<literal>address-full-policy</literal>设为<literal>DROP</literal>即可。</para>
</section>
<section>
- <title>Blocking producers</title>
- <para>Instead of paging messages when the max size is reached, an address can also be configured to block producers from sending further
- messages when the address is full, thus preventing the memory being exhausted on the server.</para>
- <para>When memory is freed up on the server, producers will automatically unblock and be able to continue sending.</para>
- <para>To do this just set the <literal>address-full-policy</literal> to <literal>BLOCK</literal> in the address settings</para>
+ <title>阻塞发送者(producer)</title>
+ <para>一个地址除了可以分页转存多余的消息外,还可以通过配置使得消息的发送者在消息达到最大值时阻塞消息
+ 的发送,以防止服务器由于消息过多而耗尽内存。</para>
+ <para>随着服务器的内存被释放,发送者自动解除阻塞,继续发送消息。</para>
+ <para>这种方式需要将<literal>address-full-policy</literal>设为<literal>BLOCK</literal>。</para>
</section>
<section>
- <title>Caution with Addresses with Multiple Queues</title>
- <para>When a message is routed to an address that has multiple queues bound to it, e.g. a
- JMS subscription, there is only 1 copy of the message in memory. Each queue only deals
- with a reference to this. Because of this the memory is only freed up once all queues
- referencing the message have delivered it. This means that if not all queues deliver the
- message we can end up in a state where messages are not delivered. </para>
- <para>For example:</para>
+ <title>对于有多个队列绑定的地址的配置注意事项</title>
+ <para>当一个消息被路由到一个绑定了多个队列(queue)的地址时(比如JMS的订阅),在内存中仍然只有一分消息的拷贝。每个
+ 队列所持有的不过是它的一个引用。因此,只有所有队列中的消息都成功地传递出去后,这个消息才会从内存中清除。也就是说
+ 只要有一个队列没有传递这个消息,那么就会造成这个消息处于未被传递的状态。 </para>
+ <para>例如:</para>
<itemizedlist>
<listitem>
- <para>An address has 10 queues </para>
+ <para>一个地址绑定了10个队列(queue)。</para>
</listitem>
<listitem>
- <para>One of the queues does not deliver its messages (maybe because of a slow
- consumer).</para>
+ <para>其中一个队列没有传递它的消息(也许因为接收者很慢)。</para>
</listitem>
<listitem>
- <para>Messages continually arrive at the address and paging is started.</para>
+ <para>消息不断增加,触发了分页转存模式。</para>
</listitem>
<listitem>
- <para>The other 9 queues are empty even though messages have been sent.</para>
+ <para>而其它9个队列尽管发送了消息,但由于地址将多余的消息转存到磁盘,所以它们都是空的。</para>
</listitem>
</itemizedlist>
- <para>In this example we have to wait until the last queue has delivered some of its
- messages before we depage and the other queues finally receive some more
- messages.</para>
+ <para>在这个例子中,必须要等到最后一个队列传递了一些消息后,那些转存的消息被装载回内存,其它队列才有机会得到更多的消息。</para>
</section>
<section>
- <title>Paging and message selectors</title>
- <note><para>Please note that message selectors will only operate on messages in memory. If you have a large amount of messages paged to disk and
- a selector that only matches some of the paged messages, then those messages won't be consumed until the messages in memory have been consumed.
- HornetQ does not scan through page files on disk to locate matching messages. To do this efficiently would mean implementing and managing indexes amongst other things.
- Effectively we would be writing a relational database! This is not the primary role of a messaging system. If you find yourself using selectors which only
- select small subsets of messages in very large queues which are too large to fit in memory at any one time, then you probably want a relational database
- not a messaging system - you're effectively executing queries over tables.</para></note>
+ <title>分页转存与消息的选择器(selector)</title>
+ <note><para>请注意消息选择器只对内存的消息进行操作。如果大量的消息被转存在磁盘中,而其中有些消息与选择器是相匹配的,
+ 那么只有内存的消息被传递,这些消息被重新装载入内存后才有可能被传递出去。
+ HornetQ不会扫描在磁盘中的消息来找出与选择器匹配的消息。这样做的话需要实现并管理一种索引机制才能使扫描有效地进行,另外
+ 需要其它额外的工作。所有这些如果去完成的话,相当于实现一个关系型数据库!这并不是消息系统的主要任务。如果你要完成的任务是
+ 从海量的消息中选择少数消息,那么你很可能需要使用的是一个关系型数据库,不是消息系统。因为这相当于表的查询。</para></note>
</section>
<section>
- <title>Paging and browsers</title>
- <note><para>Please note that message browsers only operate over messages in memory. They do not operate over messages paged to disk.
- Messages are paged to disk <emphasis>before</emphasis> they are routed to any queues, so when they are paged, they are not in any queues, so
- will not appear when browsing any queues.
-
-
+ <title>分页转存与浏览器</title>
+ <note><para>请注意浏览器只对内存中的消息进行操作,它不对转存到磁盘中的消息进行操作。
+ 消息是在被路由到任何队列<emphasis>之前</emphasis>进行转存的,所以在转存时刻,它们还没有进入到任何队列中,
+ 自然也就不可能出现在对某个队列浏览的結果中。
</para></note>
</section>
<section>
- <title>Paging and unacknowledged messages</title>
+ <title>分页转存与未通知的消息</title>
<note><para>
- Please note that until messages are acknowledged they are still in memory on the server, so they contribute to the size of messages on
- a particular address. If messages are paged to disk for an address, and are being consumed, they will be depaged from disk when enough
- memory has been freed up in that address after messages have been consumed and acknowledged. However if messages are not acknowledged
- then more messages will not be depaged since there is no free space in memory. In this case message consumption can appear to hang.
- If not acknowledging explictly messages are acknowledged according to the <literal>ack-batch-size</literal> setting. Be careful not to set your paging
- max size to a figure lower than ack-batch-size or your system may appear to hang!
+ 请注意如果消息没有被通知,它会一直留在服务器的内存中,占用着内存资源。只要消息在被接收者收到并通知后,它才
+ 会在服务器端被清除,空出内存空间以便转存在磁盘上的消息被装载到内存进行传递。如果没有通知,消息不会被清除,
+ 也就不会空出内存空间,转存到磁盘上的消息也就无法装载到内存进行传递。于是在接收端就会呈现出死机的现象。
+
+ 如果消息的通知是依靠<literal>ack-batch-size</literal>的设定进行的批量通知,那么一定要注意不要将
+ 分页转存的消息临界值设得小于<literal>ack-batch-size</literal>,否则你的系统可能会发生死机现象!
</para></note>
</section>
<section>
- <title>Example</title>
- <para>See <xref linkend="examples.paging"/> for an example which shows how to use paging
- with HornetQ.</para>
+ <title>例子</title>
+ <para><xref linkend="examples.paging"/>是一个说明如何使用HornetQ的分页转发功能的例子。</para>
</section>
</chapter>
More information about the hornetq-commits
mailing list