Mirth Community

Mirth Community (http://www.mirthcorp.com/community/forums/index.php)
-   Development (http://www.mirthcorp.com/community/forums/forumdisplay.php?f=8)
-   -   Custom web service with Parallel Message Processing (http://www.mirthcorp.com/community/forums/showthread.php?t=216083)

canessetu 06-02-2016 05:08 AM

Custom web service with Parallel Message Processing
 
I need to develope a custom search/retrive web service that manages concurrent requests processing.

Using the new feature 'Parallel Message Processing' of Mirth 3.4.0.8000, I tried developing it setting 'Max Processing Thread' parameter to 100.

I tested performance whith Jmeter tool with:
Number of Thread(Users): 100
Ramp-up period : 2 sec
Loop Count: Forever


Observing Mirth dashboard some requests have concurrent execution but in Jmeter results latency time between request and response increases exponentially.
First Request latency time is 5000 ms
Last Request latency time is 12000 ms


Discovering in com.mirth.connect.connectors.ws.WebServiceReceiver class I found that HttpServer has backlog and poolthread size both set to 5.
Original source code from line 138 to 147:

Code:

        try {
            configuration.configureReceiver(this);
            server.bind(new InetSocketAddress(host, port), 5);
        } catch (Exception e) {
            throw new ConnectorTaskException("Error creating HTTP Server.", e);
        }

        executor = Executors.newFixedThreadPool(5);
        server.setExecutor(executor);
        server.start();

Replacing 'backlog' and 'poolthread size' with the same value as 'Max Processing Thread'.

Code:

        try {
            configuration.configureReceiver(this);
            server.bind(new InetSocketAddress(host, port), connectorProperties.getSourceConnectorProperties().getProcessingThreads());
        } catch (Exception e) {
            throw new ConnectorTaskException("Error creating HTTP Server.", e);
        }

        executor = Executors.newFixedThreadPool(connectorProperties.getSourceConnectorProperties().getProcessingThreads());
        server.setExecutor(executor);
        server.start();

Repeting the same test with Jmeter the code works with a constant latency time in every request.

About backlog configuration watch 'Note about socket backlogs'


Is this a proper way to develope it?
Is it dangerous?

narupley 06-02-2016 09:50 AM

I ran the same test with JMeter but I do not see it increasing exponentially. Those two metrics you posted, "first time" and "last time" don't mean anything by themselves. What matters is the overall trend over the course of time. Running it for several minutes, I see the average response time stay quite constant. It's definitely not increasing at all, much less exponentially.

That said, what you proposed makes sense, and should have been done for 3.4 to begin with. I've updated this issue for 3.4.1: MIRTH-2376

Thanks for the catch!


All times are GMT -8. The time now is 03:42 AM.

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