ramon 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,39 @@
1
+ require "rubygems"
2
+ require "ramon"
3
+ require "logger"
4
+
5
+ Ramon.configure do |config|
6
+ config.address = 'http://127.0.0.1:2465'
7
+ config.logger = Logger.new("/dev/null")
8
+ end
9
+
10
+ start_time = Time.now
11
+ (1..1000).each {
12
+ Ramon.log('test')
13
+ }
14
+ end_time = Time.now
15
+ puts "HTTP logging #{(end_time - start_time)} seconds"
16
+
17
+
18
+ Ramon.configure do |config|
19
+ config.address = '127.0.0.1:5464'
20
+ config.protocol = 'zeromq'
21
+ config.logger = Logger.new("/dev/null")
22
+ end
23
+
24
+ start_time = Time.now
25
+ (1..1000).each {
26
+ Ramon.log('test')
27
+ }
28
+ end_time = Time.now
29
+ puts "ZeroMQ logging #{(end_time - start_time)} seconds"
30
+
31
+
32
+ log = Logger.new('bench.log')
33
+ start_time = Time.now
34
+ (1..1000).each {
35
+ log.info('test')
36
+ }
37
+ end_time = Time.now
38
+ puts "Standard logging #{(end_time - start_time)} seconds"
39
+
@@ -68,6 +68,7 @@ module Ramon
68
68
  context = ZMQ::Context.new()
69
69
  socket = context.socket(ZMQ::DEALER)
70
70
  socket.connect("tcp://#{address}")
71
+ socket.setsockopt(ZMQ::LINGER,0)
71
72
  json_data = {:type => type,
72
73
  :content => data}
73
74
  if app_key
@@ -78,6 +79,7 @@ module Ramon
78
79
 
79
80
  socket.send(json_data, ZMQ::NOBLOCK)
80
81
  socket.close()
82
+ context.close()
81
83
  true
82
84
  end
83
85
  end
@@ -1,3 +1,3 @@
1
1
  module Ramon
2
- VERSION = "0.4.1"
2
+ VERSION = "0.4.2"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ramon
3
3
  version: !ruby/object:Gem::Version
4
- hash: 13
4
+ hash: 11
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 1
10
- version: 0.4.1
9
+ - 2
10
+ version: 0.4.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - martinrusev
@@ -45,6 +45,7 @@ files:
45
45
  - .gitignore
46
46
  - Gemfile
47
47
  - Rakefile
48
+ - benchmarks.rb
48
49
  - lib/ramon.rb
49
50
  - lib/ramon/catcher.rb
50
51
  - lib/ramon/configuration.rb