Announcement

Collapse
No announcement yet.

Thread assignment and concurrency issue

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Thread assignment and concurrency issue

    Version: 3.4.2.8129

    I have multiple incoming HL7 ports (TCP Listener), each tied to an incoming customer port.
    For the incoming channel, I have 10 queue threads.
    I have one destination (destination writer):
    Queue: Always
    Retry Interval: 10000
    Queue Threads: 5
    Thread Assignment: {listening port}, i.e. 6664, 6665

    The destination channel is configured with 10 threads, it writes to a database. The destination channel writes to a unique database for each customer (port).

    In one customer database stored procedure I introduced an artificial delay in T-SQL waiting for 5 seconds. Purposely slowing processing for one, while allowing the other to run at raw speed.

    My goal is to process sequentially and independently for each customer.
    I know I can accomplish this with unique database writer destinations.
    This is not practical.

    Based on reviewing the forum, seems that I can achieve concurrency using Thread Assignment Variables.

    If I sent 100 HL7 messages via JMeter to the slow port, I end up with a database deadlock. I assume the upstream TCP Listener Thread Assignment is not being honored by the multi-threaded destination (database writer). The 10 threads are all trying to drain the queued backlog at the same time.
    Attached Files
    Last edited by davesiracusa; 04-26-2017, 09:27 AM.

  • #2
    This would be easier to troubleshoot if you posted your exported channels (minus any passwords, etc.).
    Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

    Nicholas Rupley
    Work: 949-237-6069
    Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


    - How do I foo?
    - You just bar.

    Comment


    • #3
      Thanks. I stripped down the channels and attached them. I simulated the database write using a conditional java.lang.Thread.sleep. I left the Thread Assignment Variable for the Database Writer Sans using a reference variable. Based on inspecting Mirth Connect code, that seem bogus. I suspect the upstream incoming ports and threads don't make any sense, as the customer sends HL7 payloads sequentially from a single process/thread. Can I set the Thread Assignment using javascript in the source for the Database Writer Sans channel?

      Comment


      • #4
        Yeah there are a couple things wrong with your Thread Assignment Variable. Like the metadata table in the Channel Writer, it's looking for just the variable name, so in your case it'd just be "port_identifier" (without the quotes).

        Even if it was looking for Velocity replacement syntax, right now you have "${'port_identifier}" which is incorrect (there's an erroneous quotation mark in there).
        Step 1: JAVA CACHE...DID YOU CLEAR ...wait, ding dong the witch is dead?

        Nicholas Rupley
        Work: 949-237-6069
        Always include what Mirth Connect version you're working with. Also include (if applicable) the code you're using and full stacktraces for errors (use CODE tags). Posting your entire channel is helpful as well; make sure to scrub any PHI/passwords first.


        - How do I foo?
        - You just bar.

        Comment


        • #5
          Thanks, I hastily added a velocity style variable, shortly after posting, I tried just the variable name, and it worked. Are there any other conditions, gotchas I need to know?

          Comment

          Working...
          X