sql - psycopg2 hangs when "SELECT" statement executed against information_schema on CentOS vs python 2.6 -
i have python script executes query against postgresql database (redshift. runs fine on local machine:
ubuntu 12.10, python 2.7 psycog.__version__ = '2.5.3 (dt dec pq3 ext)' but hangs when i'm executing some queries prod machine on aws
centos 6.5 python 2.6 psycog.__version__ = '2.5.3 (dt dec pq3 ext)' here code:
import psycopg2 con = psycopg2.connect(**{<my_connection_params>}}) curs = con.cursor() # works fine on both machines !!! curs.execute("""select table_name information_schema.tables table_schema='public' , table_type='base table'""") # 1 hangs on aws, works fine laptop curs.execute('select column_name information_schema.columns') when connect db , run query see running processes can see this:
select pid, trim(user_name), starttime, substring(query,1,20) stv_recents status='running'; i can see query.
here strace -p:
ioctl(0, sndctl_tmr_stop or tcsetsw, {b38400 opost isig icanon echo ...}) = 0 rt_sigprocmask(sig_setmask, [], null, 8) = 0 rt_sigaction(sigwinch, {sig_dfl, [], sa_restorer, 0x3aaa00f710}, {0x3ab1027010, [], sa_restorer|sa_restart, 0x3aaa00f710}, 8) = 0 gettimeofday({1403280035, 826010}, null) = 0 rt_sigprocmask(sig_block, [pipe], [], 8) = 0 write(3, "\27\3\1\0 5\351br$\331\30\00563\v\211f\325\367\210\331\331\253\300\310\240"..., 122) = 122 rt_sigprocmask(sig_setmask, [], null, 8) = 0 poll([{fd=3, events=pollin|pollerr}], 1, -1) =
it turns out :
amazon ec2-classic instances can handle 1500 bytes of info per frame, while amazon ec2-vpc instances can handle 9000 bytes of info per frame. in mixed environment, recommend disabling tcp/ip jumbo frames setting mtu 1500 in amazon ec2-vpc instance; way, both instances utilize 1500 bytes maximum. not necessary if both client , cluster instances utilize amazon ec2-vpc.
http://docs.aws.amazon.com/redshift/latest/mgmt/connecting-drop-issues.html
so line solve it:
ip link set dev eth0 mtu 1500 python sql linux postgresql centos
No comments:
Post a Comment