title: IBM Websphere MQ Latency for storing persistent messages .NET client
body: <p>When MQ server receives Put() request, what factors are affecting when messages are stored? Below is potential factors:</p>
  
  <p>1) caching messages in memory for some times, or</p>
  
  <p>2) when certain number of messages are received</p>
  
  <p>3) When certain byte threshold of messages are received</p>
  
  <p>4) MQ server save it IMMEDIATELY for each message.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>That is, when Put() returns, has messages been saved to hard disk, or in cache depending on factors above?</p>
  
  <p>Any information and links to official doc would be great appreciated.</p>
  
  <p>Below is a simple scenario where Put() is used.</p>
  
  <pre><code>     void PutMessages()
      {
           Open(ConnectionMode.Write);
  
              // putting messages continuously
              for (int i = 1; i &lt;= numberOfMsgs; i++)
              {
                  PutMessage(GetMessageInBytes(i));
              }
  
              queue.Close();
              queueManager.Disconnect();          
      }
  
      void PutMessage(byte[] messageString)
      {
  
          // creating a message object
          message = new MQMessage();
          message.Write(messageString);
          message.Format = MQC.MQFMT_STRING;
          message.CharacterSet = 1208;// IbmUtf8Encoding;
          message.Persistence = MQC.MQPER_PERSISTENT;
  
          var options = new MQPutMessageOptions
          {
              Options = false ? MQC.MQPMO_SYNCPOINT : MQC.MQPMO_NO_SYNCPOINT
          };
  
          queue.Put(message, options);            
  
      }
  
      public void Open(ConnectionMode connectionMode)
      {
          var connectionSettings = new Hashtable
          {
              {MQC.TRANSPORT_PROPERTY, MQC.TRANSPORT_MQSERIES_MANAGED },
              {MQC.CONNECT_OPTIONS_PROPERTY, MQC.MQCNO_RECONNECT }
          };
  
          int openOptions = 0;
  
          switch (connectionMode)
          {
              case ConnectionMode.Read:
                  openOptions = MQC.MQOO_INPUT_SHARED + MQC.MQOO_FAIL_IF_QUIESCING;
                  break;
              case ConnectionMode.Write:
                  openOptions = MQC.MQOO_OUTPUT + MQC.MQOO_FAIL_IF_QUIESCING;
                  break;
          }
          queueManager = new MQQueueManager(queueManagerName);
          queue = queueManager.AccessQueue(queueName, openOptions);
      }
  
  
      public enum ConnectionMode
      {
          Read,
          Write
      }
  </code></pre>