Amazon Redshift Request Hangs

I am using amazon redshift and sometimes query execution hangs without any error messages, eg. this request will be executed:

select extract(year from date), extract(week from date),count(*) from some_table  where date>'2015-01-01 00:00:00' and date<'2015-12-31 23:59:59' group by extract(year from date), extract(week from date)

      

and this is not:

select extract(year from date), extract(week from date),count(*) from some_table  where date>'2014-01-01 00:00:00' and date<'2014-12-27 23:59:59' group by extract(year from date), extract(week from date)

      

But this only happens when the project is deployed to the server and on my local machine all requests are made without any problem.

I have already set in my code autoCommit=true

to connect. Also, all of the above things I do with grails using this library

        compile 'com.amazonaws:aws-java-sdk-redshift:1.9.39'

      

Any ideas?

+3


source to share


2 answers


This may not be an accurate answer, but too long for a comment.

You can check the parameter mtu

on the server running the execution.

Redshift wants to work with 1500

bytes frame and all EC2 instances are set with jumbo frame ( 9000

) by default

In order for you to be able to run queries without any problems, you need to have the same parameter mtu

.

To check what you have, run the following command:



ip addr show eth0

An example output would be like this:

eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 9001 qdisc pfifo_fast state UP qlen 1000

in this case mtu is 9001, so you need to change it to 1500 by running:

/sbin/ifconfig eth0 mtu 1500 up

+5


source


I ran into this issue while connecting to RedShift from an EC2 instance. Setting MTU didn't help, so I kept digging and found the error was related to TCP timeouts.

Doing the following on the instance I used to connect to RedShift fixed the problem:

# echo 60 > /proc/sys/net/ipv4/tcp_keepalive_time

      



This will change TCP keepalive from 7200 seconds (default) to 60 seconds.

More information can be found at: http://docs.aws.amazon.com/redshift/latest/mgmt/connecting-firewall-guidance.html

+3


source







All Articles