Hi

I’m trying to mimic *ab* load testing (I want to see the actual errors, not
just the error count) so I created the following script:

(ns test-recycle.core
  (:require [clj-http.client :as http])
  (:import (java.util.concurrent Executors)))

(def url "http://somehost/test.js";)
(def errors (atom []))
(def counter 25000)
(def threads 30)

(defn run-single-request [_]
  (fn []
    (try
      (http/get url)
      (catch Exception e (swap! errors conj (.getMessage e))))))

(defn go
  "Try to connect $count times in $threads and collect the erors"
  []
  (let [pool (Executors/newFixedThreadPool threads)
        tasks (map run-single-request (range counter))]
    (doseq [future (.invokeAll pool tasks)]
      (.get future))
    (.shutdown pool)))

This runs great (takes about 10 minutes), but if I double the counter
(50000) it probably enters some kind of loop because it’s doing some
calculations which takes lots of CPU and it doesn’t finish even after 40
minutes (the actual web requests ends after about 20 minutes). Can someone
help me understand why?

Also, is there a better way to perform this concurrent load testing (maybe
with http-kit)?

Thanks in advance
-- 
Haim

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to