~severeoverfl0w/ring-graph

4d59cbc12de6136ed51ba003dbe24d237e7e78a6 — Dominic Monroe 27 days ago 54a4524
Add support for configuring connections
1 files changed, 13 insertions(+), 3 deletions(-)

M src/io/dominic/ring_graph/core.clj
M src/io/dominic/ring_graph/core.clj => src/io/dominic/ring_graph/core.clj +13 -3
@@ 48,6 48,7 @@
                       :rows 5
                       :cols 33}
             (pr-str (get-in state [:params :heap-sizes] ["128M" "40M" "30M" "20M" "10M" "9M" "8M" "7M"]))]]]
         [:h2 "wrk"]
         [:div
          [:label "wrk threads"
           [:input {:type "text"


@@ 60,6 61,12 @@
                    :value (get-in state [:params :duration] "10")
                    :disabled (:running? state)
                    :name "duration"}]]]
         [:div
          [:label "wrk connections"
           [:input {:type "text"
                    :value (get-in state [:params :connections] "10")
                    :disabled (:running? state)
                    :name "connections"}]]]
         [:button {:type "submit"
                   :disabled (:running? state)} "Submit"]] 



@@ 88,9 95,10 @@
      (Thread/sleep 1000))))

(defn schedule-job
  [{:keys [heap-sizes duration worker-threads]
  [{:keys [heap-sizes duration worker-threads connections]
    :or {duration "10"
         worker-threads "2"}}]
         worker-threads "2"
         connections "10"}}]
  (doto
    (Thread.
      (fn []


@@ 118,6 126,7 @@
                                 "-s" "wrk.lua"
                                 "-d" duration
                                 "-t" worker-threads
                                 "-c" connections
                                 "http://localhost:8080")]
                  ;; TODO: try/finally
                  (.destroy srvp)


@@ 155,7 164,8 @@
  (when (= :post (:request-method req))
    (let [args {:heap-sizes (edn/read-string (get-in req [:form-params "values"]))
                :duration (get-in req [:form-params "duration"])
                :threads (get-in req [:form-params "threads"])}]
                :threads (get-in req [:form-params "threads"])
                :connections (get-in req [:form-params "connections"])}]
      (send-off
        state*
        (fn [old-state]