Skip to content

Instantly share code, notes, and snippets.

View kmuthukk's full-sized avatar

Kannan Muthukkaruppan kmuthukk

View GitHub Profile
# Dependencies:
# On CentOS you can install psycopg2 thus:
#
# sudo yum install postgresql-libs
# sudo yum install python-psycopg2
import psycopg2;
import time;
def create_table():
@kmuthukk
kmuthukk / ysql_user_msgs.py
Last active November 15, 2019 21:08
YSQL Sample Program - user messages/actions table
# Dependencies:
# On CentOS you can install psycopg2 thus:
#
# sudo yum install postgresql-libs
# sudo yum install python-psycopg2
import psycopg2;
import time
conn = psycopg2.connect("host=localhost dbname=yugabyte user=yugabyte port=5433")
# Dependencies:
# On CentOS you can install psycopg2 thus:
#
# sudo yum install postgresql-libs
# sudo yum install python-psycopg2
import psycopg2;
from multiprocessing.dummy import Pool as ThreadPool
num_target_refs = 10
# Dependencies:
# On CentOS you can install psycopg2 thus:
#
# sudo yum install postgresql-libs
# sudo yum install python-psycopg2
import psycopg2;
import time;
from multiprocessing.dummy import Pool as ThreadPool
# pip install yb-cassandra-driver
from cassandra.cluster import Cluster
from cassandra import ConsistencyLevel
import time
import random
from multiprocessing.dummy import Pool as ThreadPool
# Load Phase params
num_write_threads=1
<?php
$ip = '127.0.0.1';
$cluster = Cassandra::cluster()
->withDefaultConsistency(Cassandra::CONSISTENCY_QUORUM)
->withContactPoints($ip)
->build();
$session = $cluster->connect();
<?php
$ip = '127.0.0.1';
$cluster = Cassandra::cluster()
->withDefaultConsistency(Cassandra::CONSISTENCY_QUORUM)
->withContactPoints($ip)
->build();
$session = $cluster->connect();
@kmuthukk
kmuthukk / ycql_parallel_connects.py
Last active June 3, 2020 22:30
Sample program to measure overhead of authenticated connections. Test case for https://github.com/YugaByte/yugabyte-db/issues/4596
# pip install yb-cassandra-driver
from cassandra.cluster import Cluster
from cassandra.auth import PlainTextAuthProvider
import time
import random
from multiprocessing.dummy import Pool as ThreadPool
num_sessions=10
# Dependencies:
# On CentOS you can install psycopg2 thus:
#
# sudo yum install postgresql-libs
# sudo yum install python-psycopg2
import psycopg2;
import time;
from datetime import datetime
from multiprocessing.dummy import Pool as ThreadPool
@kmuthukk
kmuthukk / ycql_table_health_v1.py
Created July 15, 2020 18:08
A sample health check script to get 1 row from various partitions of the tables in a YCQL keyspace
# pip install yb-cassandra-driver
from cassandra.cluster import Cluster
# cluster = Cluster(['127.0.0.1'])
cluster = Cluster(['172.151.30.71', '172.151.28.193'])
num_checks_per_table=64
keyspace_name="ybdemo_keyspace"