-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Clojure High Performance Programming, Second Edition - Second Edition
By :
It is well known that chatty I/O calls generally lead to poor performance. In general, the solution is to batch together several messages and send them in one payload. In databases and network calls, batching is a common and useful technique to improve throughput. On the other hand, large batch sizes may actually harm throughput as they tend to incur memory overhead, and components may not be ready to handle a large batch at once. Hence, sizing the batches and throttling are just as important as batching. I would strongly advise conducting your own tests to determine the optimum batch size under representative load.
JDBC has long had batch-update support in its API, which includes the INSERT, UPDATE, DELETE statements. The Clojure contrib library java.jdbc supports JDBC batch operations via its own API, as we can see as follows:
(require '[clojure.java.jdbc :as jdbc]) ;; multiple SQL statements (jdbc/db-do-commands db true ["INSERT INTO...
Change the font size
Change margin width
Change background colour