yandex / yandex-tank

Load and performance benchmark tool

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Jmeter plugin doesn't pick up UDP port

yar0slav opened this issue · comments

Hi!

We're using Jmeter as our load generator and we've started using Tank on top of it. And we've found an issue. The logic on waiting for JMeter UDP port seem weird to me:

  def __discover_jmeter_udp_port(self):
        """Searching for line in jmeter.log such as
        Waiting for possible shutdown message on port 4445
        """
        r = re.compile(self.DISCOVER_PORT_PATTERN)
        with open(self.process_stderr.name, 'r') as f:
            cnt = 0
            while self.process.pid and cnt < 10:
                line = f.readline()
                m = r.match(line)
                if m is None:
                    cnt += 1
                    time.sleep(1)
                else:
                    port = int(m.group('port'))
                    return port
            else:
                logger.warning('JMeter UDP port wasn\'t discovered')
                return None

it actually assumes that message about UDP will appear in first 10 lines and makes 1s pause between lines. It never works for us, as this message appears around 150's line in the log (JMeter version is 5.0). So tank doesn't send shutdown message, but kills master instead slaves continue running test.
As a quick and dirty solution we've patched your method to first wait for 15s for Jmeter to come up and then look through first 200 lines for the message. It at least allows us to use tanks auto-shutdown feature. But this doesn't seem to be a normal solution to me, so only describing, not proposing to use.

Actually I agree. It is not a stable solution to search something in not structured log.
It would be much more predictable to determine the port by jmeter`s pid. But as I understood, this means that we need to rely on os internals what makes tank less portable.

Maybe we should make the port configurable from commandline for example, to avoid any discovering ?