title: AWS ELB is extremely slow and patchy
body: <p>I have setup internet-facing ELB to access webserver of Apache airflow, which runs in 8080 of the instance. </p>
  
  <p>Configuration</p>
  
  <ol>
  <li>Single-AZ ELB </li>
  <li>Autoscaling group with single m4.large instance</li>
  </ol>
  
  <p>Below is the terraform resource for the ELB</p>
  
  <pre><code>resource "aws_elb" "airflow_elb" {
    name = "${var.domain_name}-elb"
    subnets = [
      "${aws_subnet.private.id}"]
  
    security_groups = [
      "${aws_security_group.public.id}"]
  
    "listener" {
      instance_port = 8080
      instance_protocol = "http"
      lb_port = 80
      lb_protocol = "http"
    }
  
    health_check {
      healthy_threshold = "${var.elb_healthy_threshold}"
      interval = "${var.elb_interval}"
      target = "HTTP:8080/admin/"
      timeout = "${var.elb_timeout}"
      unhealthy_threshold = "${var.elb_unhealthy_threshold}"
    }
  
    access_logs {
      bucket = "${aws_s3_bucket.bucket.bucket}"
      bucket_prefix = "elb-logs"
      interval = 60
    }
  
    cross_zone_load_balancing = false
    idle_timeout = 400
    connection_draining = true
    connection_draining_timeout = 400
  
  
  
    tags {
      Name = "airflow-elb"
    }
  
  }
  </code></pre>
  
  <p>I can ssh tunnel to the private-ip instance via bastion host and the portal works without any issue. But when I access via the DNS name of the ELB it is either extremely slow, in which case I can see the request is reponded almost instantaneously from the webserver, but takes forever to load or ELB throws HTTP 503</p>
  
  <p>Please help!! </p>
  
  <p>EDIT1: Backend processing time is very high, but I can see that happens only when accessed from ELB, when done from tunneled connection it behaves normally. </p>