Yesterday, I was perf testing my small app (my first NodeJS app). I thought I'd do a small, ghetto test: bash forloop with curl and payload to be saved.

My favorite is "for i in {0..100}; do ... ; done". I start firing these bad boys in separate tabs. Everything works fine. I check the DB... Saved results: 303.

I break into sweats. Do I have a race condition? Holy shit, is my DB layer unsafe? Fuck fuck fuck.

I fire the forloop only once. Saved results: 101. FUCK.

I run the for loop for 0..10. Saved results: 11. Huh?

I promptly realize 0..10 runs 11 times. I'm a dumbass.

/Me proceeds to deploy my code to a kubernetes lab instance with https://youtube.com/watch/... playing in the back of my mind.

  • 0
    So i guess ur firs loop was for 0 ... 300? Not 100

    Btw what r u storing? I‘m interested in the results and ur setup
  • 1
    Off by one ...

  • 2
    @mojo2012 no, probably 3tabs
  • 0
    @mojo2012 I fired it in 3 tabs, so that I'd have some concurrent saves... So 0..100 in 3 tabs = 300 overall.

    It's a small project to parse POST payload and track it in MongoDB. I'm hoping we'll use it at work, but if not, at least I got to fiddle with some to-me-unknown technologies :)
  • 0
    Whats ur average response time and payload size?
    I would be curious about the results of 350-500 concurrent requests, thats what I‘m testing my framework right now
    I use jmeter btw
  • 3
    Oh man, I can totally see myself doing this. Minus the kubernetes stuff cuz that's magic to me...
Add Comment