Skip to content
This repository has been archived by the owner on Nov 13, 2018. It is now read-only.

add connection caching to TO #1319

Merged
merged 3 commits into from
Apr 19, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions traffic_ops/app/lib/Connection/RiakAdapter.pm
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ use Mojo::UserAgent;
use JSON;
use IO::Socket::SSL qw();
use File::Slurp;
use TrafficOps;

# This Perl Module was needed to better support SSL for the 'Vault'
use LWP::UserAgent qw();
Expand Down Expand Up @@ -53,6 +54,7 @@ sub new {
$ua = LWP::UserAgent->new();
$ua->timeout(20);
$ua->ssl_opts( verify_hostname => 0, SSL_verify_mode => 0x00 );
$ua->conn_cache($TrafficOps::conn_cache);

return $self;
}
Expand Down
5 changes: 4 additions & 1 deletion traffic_ops/app/lib/TrafficOps.pm
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ use Schema;
use Data::Dumper;
use Digest::SHA1 qw(sha1_hex);
use JSON;
use LWP::ConnCache;
use Cwd;

use Mojolicious::Plugins;
Expand Down Expand Up @@ -58,6 +59,7 @@ my $app_root_dir;
my $mode;
my $config;

my $conn_cache; # Connection Pool
local $/; #Enable 'slurp' mode

has schema => sub { return Schema->connect_to_database };
Expand Down Expand Up @@ -185,8 +187,9 @@ sub startup {
$rh->load();

##help relieve issues with riak
IO::Socket::SSL::set_default_session_cache(IO::Socket::SSL::Session_Cache->new( 1024 ));
IO::Socket::SSL::set_default_session_cache(IO::Socket::SSL::Session_Cache->new( 4096 ));

$conn_cache = LWP::ConnCache->new( { total_capacity => 4096 } );
}

sub setup_logging {
Expand Down