web stats
Thread assignment and concurrency issue - Mirth Community

Go Back   Mirth Community > Mirth Connect > Support

Reply
 
Thread Tools Display Modes
  #1  
Old 04-26-2017, 04:47 AM
davesiracusa davesiracusa is offline
Mirth Newb
 
Join Date: Sep 2014
Posts: 8
davesiracusa is on a distinguished road
Question 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
File Type: zip channels.zip (12.5 KB, 16 views)

Last edited by davesiracusa; 04-26-2017 at 09:27 AM.
Reply With Quote
  #2  
Old 04-26-2017, 06:14 AM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,097
narupley is on a distinguished road
Default

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.
Reply With Quote
  #3  
Old 04-26-2017, 09:32 AM
davesiracusa davesiracusa is offline
Mirth Newb
 
Join Date: Sep 2014
Posts: 8
davesiracusa is on a distinguished road
Default

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?
Reply With Quote
  #4  
Old 04-26-2017, 11:29 AM
narupley's Avatar
narupley narupley is online now
Mirth Employee
 
Join Date: Oct 2010
Posts: 7,097
narupley is on a distinguished road
Default

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.
Reply With Quote
  #5  
Old 04-27-2017, 08:57 AM
davesiracusa davesiracusa is offline
Mirth Newb
 
Join Date: Sep 2014
Posts: 8
davesiracusa is on a distinguished road
Default

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?
Reply With Quote
Reply

Tags
assignment, concurrency, mirth connect, performance, thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 12:05 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Mirth Corporation