You can do two things to improve performance. First is to use the executeAsynch function in the driver instead of execute
.
Second thing is to use a batch statement instead of a loop (I know you mentioned it's not the purpose of the test, but when it comes to inserts with a loop, batching is what you want).
PreparedStatement ps = session.prepare("INSERT INTO messages (user_id, msg_id, title, body) " +
"VALUES (?, ?, ?, ?)");
BatchStatement batch = new BatchStatement();
batch.add(ps.bind(uid, mid1, title1, body1));
batch.add(ps.bind(uid, mid2, title2, body2));
batch.add(ps.bind(uid, mid3, title3, body3));
session.execute(batch);