synapse 0.2.1 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -0
- data/.mailmap +3 -0
- data/LICENSE.txt +2 -2
- data/Makefile +6 -0
- data/README.md +42 -13
- data/bin/synapse +29 -21
- data/config/hostheader_test.json +71 -0
- data/config/svcdir_test.json +46 -0
- data/config/synapse.conf.json +26 -32
- data/config/synapse_services/service1.json +24 -0
- data/config/synapse_services/service2.json +24 -0
- data/lib/synapse.rb +39 -24
- data/lib/synapse/base.rb +1 -1
- data/lib/synapse/haproxy.rb +579 -22
- data/lib/synapse/log.rb +24 -0
- data/lib/synapse/service_watcher.rb +10 -6
- data/lib/synapse/service_watcher/base.rb +33 -11
- data/lib/synapse/service_watcher/dns.rb +28 -20
- data/lib/synapse/service_watcher/docker.rb +108 -0
- data/lib/synapse/service_watcher/ec2tag.rb +1 -1
- data/lib/synapse/service_watcher/zookeeper.rb +25 -28
- data/lib/synapse/version.rb +1 -1
- data/spec/spec_helper.rb +2 -2
- data/synapse.gemspec +2 -3
- metadata +15 -25
- data/Vagrantfile +0 -112
- data/chef/converge +0 -4
- data/chef/cookbooks/lxc/recipes/default.rb +0 -2
- data/chef/cookbooks/synapse/attributes/default.rb +0 -1
- data/chef/cookbooks/synapse/recipes/default.rb +0 -6
- data/chef/run.json +0 -8
- data/chef/run.rb +0 -2
- data/client/.RData +0 -0
- data/client/.Rhistory +0 -294
- data/client/bench_rewrite_config.dat +0 -2013
- data/client/benchmark-client.iml +0 -20
- data/client/pom.xml +0 -45
- data/client/src/main/java/ClientArsch.java +0 -68
- data/client/src/main/java/META-INF/MANIFEST.MF +0 -3
- data/haproxy.pid +0 -1
- data/lib/gen-rb/endpoint_types.rb +0 -65
- data/lib/gen-rb/thrift.rb +0 -65
- data/test.sh +0 -3
data/client/benchmark-client.iml
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
3
|
-
<component name="NewModuleRootManager" inherit-compiler-output="false">
|
4
|
-
<output url="file://$MODULE_DIR$/target/classes" />
|
5
|
-
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
6
|
-
<content url="file://$MODULE_DIR$">
|
7
|
-
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
8
|
-
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
|
9
|
-
<excludeFolder url="file://$MODULE_DIR$/target" />
|
10
|
-
</content>
|
11
|
-
<orderEntry type="inheritedJdk" />
|
12
|
-
<orderEntry type="sourceFolder" forTests="false" />
|
13
|
-
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpclient:4.2.1" level="project" />
|
14
|
-
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpcore:4.2.1" level="project" />
|
15
|
-
<orderEntry type="library" name="Maven: commons-logging:commons-logging:1.1.1" level="project" />
|
16
|
-
<orderEntry type="library" name="Maven: commons-codec:commons-codec:1.6" level="project" />
|
17
|
-
<orderEntry type="library" name="Maven: com.google.guava:guava:13.0-final" level="project" />
|
18
|
-
</component>
|
19
|
-
</module>
|
20
|
-
|
data/client/pom.xml
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
3
|
-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
4
|
-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
5
|
-
<modelVersion>4.0.0</modelVersion>
|
6
|
-
|
7
|
-
<groupId>benchmark-client</groupId>
|
8
|
-
<artifactId>benchmark-client</artifactId>
|
9
|
-
<version>1.0</version>
|
10
|
-
|
11
|
-
<dependencies>
|
12
|
-
<dependency>
|
13
|
-
<groupId>org.apache.httpcomponents</groupId>
|
14
|
-
<artifactId>httpclient</artifactId>
|
15
|
-
<version>4.2.1</version>
|
16
|
-
</dependency>
|
17
|
-
<dependency>
|
18
|
-
<groupId>com.google.guava</groupId>
|
19
|
-
<artifactId>guava</artifactId>
|
20
|
-
<version>13.0-final</version>
|
21
|
-
</dependency>
|
22
|
-
</dependencies>
|
23
|
-
|
24
|
-
<build>
|
25
|
-
<plugins>
|
26
|
-
<plugin>
|
27
|
-
<groupId>org.apache.maven.plugins</groupId>
|
28
|
-
<artifactId>maven-shade-plugin</artifactId>
|
29
|
-
<version>1.6</version>
|
30
|
-
<configuration>
|
31
|
-
<!-- put your configurations here -->
|
32
|
-
</configuration>
|
33
|
-
<executions>
|
34
|
-
<execution>
|
35
|
-
<phase>package</phase>
|
36
|
-
<goals>
|
37
|
-
<goal>shade</goal>
|
38
|
-
</goals>
|
39
|
-
</execution>
|
40
|
-
</executions>
|
41
|
-
</plugin>
|
42
|
-
</plugins>
|
43
|
-
</build>
|
44
|
-
|
45
|
-
</project>
|
@@ -1,68 +0,0 @@
|
|
1
|
-
import org.apache.http.HttpEntity;
|
2
|
-
import org.apache.http.HttpResponse;
|
3
|
-
import org.apache.http.client.methods.HttpPost;
|
4
|
-
import org.apache.http.impl.client.DefaultHttpClient;
|
5
|
-
import org.apache.http.impl.conn.PoolingClientConnectionManager;
|
6
|
-
|
7
|
-
import java.io.IOException;
|
8
|
-
import java.util.concurrent.Executors;
|
9
|
-
import java.util.concurrent.ScheduledExecutorService;
|
10
|
-
import java.util.concurrent.ScheduledFuture;
|
11
|
-
import java.util.concurrent.TimeUnit;
|
12
|
-
|
13
|
-
/**
|
14
|
-
* @author Tobi Knaup
|
15
|
-
*/
|
16
|
-
public class ClientArsch {
|
17
|
-
|
18
|
-
public static final int NUM_THREADS = 10;
|
19
|
-
public static final int INTERVAL_MS = 25;
|
20
|
-
|
21
|
-
private final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
|
22
|
-
|
23
|
-
public static void main(String[] args) {
|
24
|
-
new ClientArsch().run();
|
25
|
-
}
|
26
|
-
|
27
|
-
public void run() {
|
28
|
-
|
29
|
-
// final PoolingClientConnectionManager cm = new PoolingClientConnectionManager();
|
30
|
-
// cm.setMaxTotal(100);
|
31
|
-
|
32
|
-
for (int i = 0; i < NUM_THREADS; i++) {
|
33
|
-
scheduler.scheduleAtFixedRate(new PostThread(String.valueOf(i)), 0, INTERVAL_MS, TimeUnit.MILLISECONDS);
|
34
|
-
}
|
35
|
-
|
36
|
-
// final ScheduledFuture<?> clientHandle =
|
37
|
-
}
|
38
|
-
|
39
|
-
class PostThread implements Runnable {
|
40
|
-
|
41
|
-
DefaultHttpClient httpClient;
|
42
|
-
HttpPost httpPost;
|
43
|
-
String id;
|
44
|
-
|
45
|
-
public PostThread(String id) {
|
46
|
-
super();
|
47
|
-
this.id = id;
|
48
|
-
this.httpClient = new DefaultHttpClient();
|
49
|
-
this.httpPost = new HttpPost("http://localhost:8088/search/test");
|
50
|
-
}
|
51
|
-
|
52
|
-
public void run() {
|
53
|
-
try {
|
54
|
-
Long tic = System.nanoTime();
|
55
|
-
HttpResponse response = httpClient.execute(httpPost);
|
56
|
-
Long toc = System.nanoTime();
|
57
|
-
|
58
|
-
System.out.printf("%s\t%d\t%d\t%d\n", id, (toc / 1000L), (toc - tic) / 1000L, response.getStatusLine().getStatusCode());
|
59
|
-
|
60
|
-
HttpEntity entity = response.getEntity();
|
61
|
-
entity.getContent().close(); // release client
|
62
|
-
} catch (IOException e) {
|
63
|
-
e.printStackTrace();
|
64
|
-
}
|
65
|
-
}
|
66
|
-
}
|
67
|
-
|
68
|
-
}
|
data/haproxy.pid
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
189
|
@@ -1,65 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Autogenerated by Thrift
|
3
|
-
#
|
4
|
-
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
5
|
-
#
|
6
|
-
|
7
|
-
require 'set'
|
8
|
-
require 'thrift'
|
9
|
-
|
10
|
-
module Twitter
|
11
|
-
module Thrift
|
12
|
-
module Status
|
13
|
-
DEAD = 0
|
14
|
-
STARTING = 1
|
15
|
-
ALIVE = 2
|
16
|
-
STOPPING = 3
|
17
|
-
STOPPED = 4
|
18
|
-
WARNING = 5
|
19
|
-
VALUE_MAP = {0 => "DEAD", 1 => "STARTING", 2 => "ALIVE", 3 => "STOPPING", 4 => "STOPPED", 5 => "WARNING"}
|
20
|
-
VALID_VALUES = Set.new([DEAD, STARTING, ALIVE, STOPPING, STOPPED, WARNING]).freeze
|
21
|
-
end
|
22
|
-
|
23
|
-
class Endpoint
|
24
|
-
include ::Thrift::Struct, ::Thrift::Struct_Union
|
25
|
-
HOST = 1
|
26
|
-
PORT = 2
|
27
|
-
|
28
|
-
FIELDS = {
|
29
|
-
HOST => {:type => ::Thrift::Types::STRING, :name => 'host'},
|
30
|
-
PORT => {:type => ::Thrift::Types::I32, :name => 'port'}
|
31
|
-
}
|
32
|
-
|
33
|
-
def struct_fields; FIELDS; end
|
34
|
-
|
35
|
-
def validate
|
36
|
-
end
|
37
|
-
|
38
|
-
::Thrift::Struct.generate_accessors self
|
39
|
-
end
|
40
|
-
|
41
|
-
class ServiceInstance
|
42
|
-
include ::Thrift::Struct, ::Thrift::Struct_Union
|
43
|
-
SERVICEENDPOINT = 1
|
44
|
-
ADDITIONALENDPOINTS = 2
|
45
|
-
STATUS = 3
|
46
|
-
|
47
|
-
FIELDS = {
|
48
|
-
SERVICEENDPOINT => {:type => ::Thrift::Types::STRUCT, :name => 'serviceEndpoint', :class => Twitter::Thrift::Endpoint},
|
49
|
-
ADDITIONALENDPOINTS => {:type => ::Thrift::Types::MAP, :name => 'additionalEndpoints', :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::STRUCT, :class => Twitter::Thrift::Endpoint}},
|
50
|
-
STATUS => {:type => ::Thrift::Types::I32, :name => 'status', :enum_class => Twitter::Thrift::Status}
|
51
|
-
}
|
52
|
-
|
53
|
-
def struct_fields; FIELDS; end
|
54
|
-
|
55
|
-
def validate
|
56
|
-
unless @status.nil? || Twitter::Thrift::Status::VALID_VALUES.include?(@status)
|
57
|
-
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field status!')
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
::Thrift::Struct.generate_accessors self
|
62
|
-
end
|
63
|
-
|
64
|
-
end
|
65
|
-
end
|
data/lib/gen-rb/thrift.rb
DELETED
@@ -1,65 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Autogenerated by Thrift
|
3
|
-
#
|
4
|
-
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
5
|
-
#
|
6
|
-
|
7
|
-
require 'set'
|
8
|
-
require 'thrift'
|
9
|
-
|
10
|
-
module Twitter
|
11
|
-
module Thrift
|
12
|
-
module Status
|
13
|
-
DEAD = 0
|
14
|
-
STARTING = 1
|
15
|
-
ALIVE = 2
|
16
|
-
STOPPING = 3
|
17
|
-
STOPPED = 4
|
18
|
-
WARNING = 5
|
19
|
-
VALUE_MAP = {0 => "DEAD", 1 => "STARTING", 2 => "ALIVE", 3 => "STOPPING", 4 => "STOPPED", 5 => "WARNING"}
|
20
|
-
VALID_VALUES = Set.new([DEAD, STARTING, ALIVE, STOPPING, STOPPED, WARNING]).freeze
|
21
|
-
end
|
22
|
-
|
23
|
-
class Endpoint
|
24
|
-
include ::Thrift::Struct, ::Thrift::Struct_Union
|
25
|
-
HOST = 1
|
26
|
-
PORT = 2
|
27
|
-
|
28
|
-
FIELDS = {
|
29
|
-
HOST => {:type => ::Thrift::Types::STRING, :name => 'host'},
|
30
|
-
PORT => {:type => ::Thrift::Types::I32, :name => 'port'}
|
31
|
-
}
|
32
|
-
|
33
|
-
def struct_fields; FIELDS; end
|
34
|
-
|
35
|
-
def validate
|
36
|
-
end
|
37
|
-
|
38
|
-
::Thrift::Struct.generate_accessors self
|
39
|
-
end
|
40
|
-
|
41
|
-
class ServiceInstance
|
42
|
-
include ::Thrift::Struct, ::Thrift::Struct_Union
|
43
|
-
SERVICEENDPOINT = 1
|
44
|
-
ADDITIONALENDPOINTS = 2
|
45
|
-
STATUS = 3
|
46
|
-
|
47
|
-
FIELDS = {
|
48
|
-
SERVICEENDPOINT => {:type => ::Thrift::Types::STRUCT, :name => 'serviceEndpoint', :class => Twitter::Thrift::Endpoint},
|
49
|
-
ADDITIONALENDPOINTS => {:type => ::Thrift::Types::MAP, :name => 'additionalEndpoints', :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::STRUCT, :class => Twitter::Thrift::Endpoint}},
|
50
|
-
STATUS => {:type => ::Thrift::Types::I32, :name => 'status', :enum_class => Twitter::Thrift::Status}
|
51
|
-
}
|
52
|
-
|
53
|
-
def struct_fields; FIELDS; end
|
54
|
-
|
55
|
-
def validate
|
56
|
-
unless @status.nil? || Twitter::Thrift::Status::VALID_VALUES.include?(@status)
|
57
|
-
raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field status!')
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
::Thrift::Struct.generate_accessors self
|
62
|
-
end
|
63
|
-
|
64
|
-
end
|
65
|
-
end
|
data/test.sh
DELETED