This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import psycopg2; | |
from multiprocessing.dummy import Pool as ThreadPool | |
num_write_threads=2 | |
num_users=10000 | |
def create_table(): | |
conn = psycopg2.connect("host=localhost dbname=postgres user=postgres port=5433") | |
conn.set_session(autocommit=True) | |
cur = conn.cursor() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Dependencies: | |
# On CentOS you can install psycopg2 thus: | |
# | |
# sudo yum install postgresql-libs | |
# sudo yum install python-psycopg2 | |
# | |
import psycopg2 | |
import time | |
import random |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import psycopg2 | |
from threading import Thread,Semaphore | |
from multiprocessing.dummy import Pool as ThreadPool | |
# | |
# The test uses the classic example of a set of black and white items to | |
# illustrate the need, in some situations, for transaction support with | |
# serializable isolation level. | |
# | |
# In this test two concurrent transactions- one that flips white colored |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import psycopg2; | |
import time | |
import random | |
from multiprocessing.dummy import Pool as ThreadPool | |
# Load Phase params | |
num_write_threads=4 | |
num_users=500 | |
num_msgs=50 | |
table_name = "user_actions" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import psycopg2; | |
import time | |
from multiprocessing.dummy import Pool as ThreadPool | |
num_threads=8 | |
num_users=1000 | |
num_msgs=50 | |
table_name = "user_actions" | |
def create_table(): |
NewerOlder