How to control reindexing that results in high log send queue
Insert the following code into the IndexOptimize procedure to implement a wait that will allow the log send queues to flush before continuing.  As written it will continue once there is less than 1 GB in the log send queues.

/* Pause until the log send queue is less than 1 GB */ 
WHILE ( (SELECT Sum(log_send_queue_size) 
         FROM   sys.dm_hadr_database_replica_states 
         WHERE  is_local = 0) &gt; 1000000 ) 
  BEGIN 
      WAITFOR delay '00:01:00' 
  END 


This code needs to be placed immediately after the IF @Delay &gt; 0 block in the procedure.  With the current version of IndexOptimize, it would look like this:

IF @Delay &gt; 0
BEGIN
    SET @CurrentDelay = DATEADD(ss,@Delay,'1900-01-01')
    WAITFOR DELAY @CurrentDelay
END

/* Pause until the log send queue is less than 1 GB */ 
WHILE ( (SELECT Sum(log_send_queue_size) 
         FROM   sys.dm_hadr_database_replica_states 
         WHERE  is_local = 0) &gt; 1000000 ) 
  BEGIN 
      WAITFOR delay '00:01:00' 
  END