Note that there are some explanatory texts on larger screens.

plurals
  1. POClojure Cassandra Driver Performance
    primarykey
    data
    text
    <p>I'm testing the performance of Alia in Clojure on a 6 node Cassandra cluster. Even when multi-threading I can only get about 400 writes/sec. With the Firebrand Cassandra driver and manually handling threading in Java we are able to get 5000 writes/sec with 96 threads.</p> <p>Am I doing something wrong in my utilization of agents here? The CPU usage is only ~25% on the machine which this is running on which seems really low.</p> <p>Update: At the author of Alia's suggestion, utilizing prepared statements instead of raw statements realized gains of up to 2500/sec in a synchronous, single-threaded fashion. I still need to test this by multi-threading with Clojure and separately utilizing the async function built into Alia/the underlying Java driver to see which is faster.</p> <p>Update 2: I am now seeing similar results to mpenet below by additionally utilizing the async functionality built into the driver.</p> <pre><code>(ns alia-perf-test.core (:gen-class) (:require [qbits.alia :as alia] [qbits.hayt :as hayt])) (defn exec-query [session query] (alia/execute session (hayt/-&gt;raw query))) (defmacro time-query [expr] `(let [start# (. System (nanoTime)) ret# ~expr] (/ (double (- (. System (nanoTime)) start#)) 1000000.0))) (defn write-entity [total-time session entity] (let [query (hayt/-&gt;raw (hayt/insert :entities (hayt/values entity) (hayt/using :timestamp 1234))) query-time (time-query (alia/execute session query))] (+ total-time query-time))) (defn generate-entity [] {:id (str (java.util.UUID/randomUUID)) :num 0}) (defn write-something [write-agent session] (send-off write-agent write-entity session (generate-entity))) (defn -main [&amp; args] (let [cluster (alia/cluster ["server1" "server2" "server3" "server4" "server5" "server6"] :pooling-options {:core-connections-per-host [:local 16 :remote 16] :max-connections-per-host [:local 1000 :remote 1000] :max-simultaneous-requests-per-connection [:local 32 :remote 32] :min-simultaneous-requests-per-connection [:local 16 :remote 16]}) session (alia/connect cluster)] (alia/set-consistency! :any) (exec-query session (hayt/create-keyspace :aliaperftest (hayt/with {:replication {:class "NetworkTopologyStrategy" :dc1 3 :dc2 3}}))) (exec-query session (hayt/use-keyspace :aliaperftest)) (exec-query session (hayt/create-table :entities (hayt/column-definitions {:id :varchar :num :int :primary-key [:id]}))) (let [num-entities 10000 write-agent (agent 0)] (dotimes [n num-entities] (write-something write-agent session)) (await write-agent) (println "Wrote" num-entities "entities in" @write-agent "ms -" (* (/ num-entities @write-agent) 1000.0) "ops/sec")) (exec-query session (hayt/drop-table :entities)) (exec-query session (hayt/drop-keyspace :aliaperftest)) (alia/shutdown session) (alia/shutdown cluster) (shutdown-agents))) </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload