lm (Load Measure)

pronounciation: [el em]

@hakaicode

2019-09-08

Problem

JMeter

- heavy

- complex configuration window

- xml config is hard to edit manually

 

Gatling

- Be able to write source code but not suitable for using IDE

- No server-client distribution model

- Can't handover to non-programmer

 

Solution: lm

- Light

- Use hocon for config file

- Both cli & web (needs http knowledge but simple setting)

- Server-client model

- proxy record mode (low priority cuz SPA can't record correctly)

lm.conf

{
  servers: {
    default: "htttp://example.com"
  },
  executors : {
    default: {
      threads: 10,
      rampUp: 10,
      loop: 100
    }
  },
  user-agents: {
  default: "lm/1.0",
  chrome77-mac: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3864.0 Safari/537.36"
}
  actions {
    main: {
      // you can omit default parameters
      // server: default
      // executor: default
      // cookies: on (send cookies received before)
      // user-agent: default
      
      // action <method> <url> [data]
      GET /
      GET /login
      POST /login email=user1@example.com&password=123456
      
}
}
}
{
  actions: {
    main: {
      server: "htttp://example.com",
      paths: [ 
        "GET /",
        "GET /login",
        "POST /login email=user1@example.com&password=123456"
      ]
    }
  }
}
actions.filter(::filter).map(::collect).waitAll().reduce(::sum)

//actions.map{a->a.collect}.reduce(Result.empty, {a,b -> a+b})
fun filter = a -> a.enabled
fun collect = a -> async { a.collect()} // TODO threads,rampUp
fun sum = a,b -> a+b

data class Results{
  oprator fun plus()
  values:List<Result>
}
  
data class Request(
  val server
  val method
  val url
  val headers
   fun cookies: Cookies = headers["cookie"]
);

data class Response(
  val time
  val headers
  val body
  fun cookies = headers["set-cookie"] 
)

run in Kotlin

config details

Q. Why Kotlin?

Stress tool must need resources. 

R U crazy?

Will you die?

A. Hmm, good question.

I will try to compile as Kotlin-native.

I may rewrite in Rust someday.

 

maybe.

lm: modern http stress tool

By hakaicode

lm: modern http stress tool

  • 321