Forum Discussion

Eduardo_Saito_1's avatar
Eduardo_Saito_1
Icon for Nimbostratus rankNimbostratus
Jan 11, 2008

Creating a service queue - q request at a time

Hello Everybody.

First of all Happy New Year!

I have a service that could not have more than a 1 connection at a time.

I have a BIG-IP in front os this server.

My goal is to deal with one connection at a time, creating a queue.

This is the iRule I'm working on:


when RULE_INIT {
   set ::queue_index 0
   set ::queue_current_pos 1
   set ::queue_size 0
   set ::queue_size_max 500
}
when CLIENT_ACCEPTED {
   
    Queue Entrance
   incr ::queue_size
   log local0.info "Queue Size: $::queue_size"
   if {$::queue_index equals $::queue_size_max} {
      set ::queue_index 0
   }
   incr ::queue_index
   set my_index $::queue_index
   log local0.info "my Indice: $my_index"
   
    Colect Data
   TCP::collect
}
when CLIENT_DATA {      
      if { $my_index equals $::queue_current_pos }{
          If its my time
         TCP::release
         log local0.info "My time: $::queue_current_pos"
          Collect - CLIENT_DATA will run again (or not?)
         TCP::collect
      }
}
when CLIENT_CLOSED {
       Queue Exit
      incr ::queue_size -1
      if {$::queue_current_pos equals $::queue_size_max} {
         set ::queue_current_pos 0
      }
      incr ::queue_current_pos
      log local0.info "Exiting..."
      log local0.info "Current Pos: $::queue_current_pos"
      log local0.info "Current Index: $::queue_index"
      log local0.info "Queue size: $::queue_size"
}

Problem:

When I have 2 connections and the first one is doing his job, the second one is on "CLIENT_DATA" with no RELEASE (kind of a buffer and in a wait situation).

After the first one liberate the queue for the second connection, it will only work if the second connection send another string. (Otherwise it won't enter CLIENT_DATA again).

I've tried creating a timer to check if the queue is open on the second connection from time to time, but all TCL timers commands are disabled on iRule.

Can anyone help me?

Thanks!
No RepliesBe the first to reply