In checking a report of defined?() calls being a hot spot in a fog application, I wanted to measure that actual overhead.
Here's the very simple benchmark code:
require 'benchmark/ips'
DEFINED_CONST = true
Benchmark.ips do |x|
| nirvdrum@melchior ~ $ traceroute 23.45.65.40 | |
| traceroute to 23.45.65.40 (23.45.65.40), 30 hops max, 60 byte packets | |
| 1 DD-WRT (192.168.11.1) 0.995 ms 1.119 ms 1.473 ms | |
| 2 192.168.1.1 (192.168.1.1) 2.365 ms 2.495 ms 2.630 ms | |
| 3 L100.BSTNMA-VFTTP-150.verizon-gni.net (71.162.119.1) 3.599 ms 4.173 ms 4.603 ms | |
| 4 G0-12-1-7.BSTNMA-LCR-21.verizon-gni.net (130.81.140.202) 8.427 ms 8.663 ms 11.861 ms | |
| 5 ae9-0.BOS-BB-RTR1.verizon-gni.net (130.81.163.164) 19.145 ms 21.085 ms ae1-0.BOS-BB-RTR1.verizon-gni.net (130.81.151.60) 9.519 ms | |
| 6 0.ae11.XL3.NYC1.ALTER.NET (152.63.20.69) 15.844 ms 17.897 ms 12.819 ms | |
| 7 0.xe-8-2-0.GW13.NYC1.ALTER.NET (152.63.4.137) 11.311 ms 0.xe-8-3-0.GW13.NYC1.ALTER.NET (152.63.5.1) 11.546 ms 0.xe-8-0-0.GW13.NYC1.ALTER.NET (152.63.19.49) 13.501 ms | |
| 8 comcast.com.customer.alter.net (152.179.220.126) 15.263 ms 13.430 ms 16.229 ms |
| <% | |
| @path = "/etc/graylog2.d/rules/graylog2.drl" | |
| %> | |
| import org.graylog2.messagehandlers.gelf.GELFMessage | |
| rule "Drop Selenium Grid heartbeat messages" | |
| when | |
| m : GELFMessage( facility == "selenium" && fullMessage matches ".*\\/status\\)?$" ) | |
| then | |
| m.setFilterOut(true); |
| # REQUIRED: The name of your application | |
| app_name: foo | |
| # REQUIRED: The system user to run your app servers as | |
| app_user: foo | |
| # REQUIRED: Notification emails (e.g. monit) get sent to this address | |
| # | |
| admin_email: "webmaster@foo.com" |
| java.lang.NullPointerException | |
| at java.util.concurrent.ConcurrentHashMap.hash(ConcurrentHashMap.java:333) | |
| at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:988) | |
| at org.jruby.RubyModule.cacheHit(RubyModule.java:984) | |
| at org.jruby.RubyModule.searchWithCache(RubyModule.java:943) | |
| at org.jruby.RubyModule.searchMethod(RubyModule.java:933) | |
| at org.jruby.RubyClass.finvoke(RubyClass.java:523) | |
| at org.jruby.RubyBasicObject.send19(RubyBasicObject.java:1504) | |
| at org.jruby.RubyKernel.send19(RubyKernel.java:2240) | |
| at org.jruby.RubyKernel$INVOKER$s$send19.call(RubyKernel$INVOKER$s$send19.gen) |
| def element_generator(count) | |
| ['{"class": "LocationUpdateWorker", "queue": "default", "args": {} }'] * count | |
| end | |
| def batched(element_count, batch_size) | |
| Sidekiq.redis do |r| | |
| r.del(:list_test) | |
| r.rpush(:list_test, element_generator(element_count)) | |
| start = Time.now |
| require 'benchmark' | |
| CYCLES = 1_000_000 | |
| app = lambda do |env| | |
| [ | |
| 200, | |
| { 'Content-Type' => 'text/html' }, | |
| ['Hello World'] | |
| ] |
| 23:41:17,368 ERROR [org.apache.catalina.connector] (ajp-/172.16.3.2:8009-4) JBWEB001018: An exception or error occurred in the container during the request processing: java.lang.NullPointerException | |
| at org.jboss.as.web.session.ClusteredSession.update(ClusteredSession.java:973) [jboss-as-web-7.2.x.slim.tb3.incremental.2.jar:7.2.x.slim.tb3.incremental.2] | |
| at org.jboss.as.web.session.DistributableSessionManager.loadSession(DistributableSessionManager.java:1389) [jboss-as-web-7.2.x.slim.tb3.incremental.2.jar:7.2.x.slim.tb3.incremental.2] | |
| at org.jboss.as.web.session.DistributableSessionManager.findSession(DistributableSessionManager.java:681) [jboss-as-web-7.2.x.slim.tb3.incremental.2.jar:7.2.x.slim.tb3.incremental.2] | |
| at org.jboss.as.web.session.DistributableSessionManager.findSession(DistributableSessionManager.java:84) [jboss-as-web-7.2.x.slim.tb3.incremental.2.jar:7.2.x.slim.tb3.incremental.2] | |
| at org.apache.catalina.connector.Request.doGetSession(Request.java:2605) [jbossweb-7.2.0.Final.jar:7.2.0.Final] | |
| at |
| ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 48) MSC00001: Failed to start service jboss.infinispan.web.default-host/ROOT: org.jboss.msc.service.StartException in service jboss.infinispan.web.default-host/ROOT: org.infinispan.CacheException: Unable to invoke method publ | |
| ic void org.infinispan.statetransfer.StateTransferManagerImpl.waitForInitialStateTransferToComplete() throws java.lang.InterruptedException on object of type StateTransferManagerImpl | |
| at org.jboss.as.clustering.msc.AsynchronousService$1.run(AsynchronousService.java:87) [jboss-as-clustering-common-7.2.x.slim.incremental.9.jar:7.2.x.slim.incremental.9] | |
| at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_45] | |
| at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_45] | |
| at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_45] | |
| at org.jboss.threads.JBossThread.run(JBossThread.java:122) [jboss-threads-2.1.0. |
In checking a report of defined?() calls being a hot spot in a fog application, I wanted to measure that actual overhead.
Here's the very simple benchmark code:
require 'benchmark/ips'
DEFINED_CONST = true
Benchmark.ips do |x|
| incompatible character encodings: ASCII-8BIT and US-ASCII | |
| org/jruby/ext/stringio/StringIO.java:1155:in `write' | |
| /usr/local/rbenv/versions/jruby-1.7.8/lib/ruby/gems/shared/gems/bindata-1.4.5/lib/bindata/io.rb:266:in `write_little_endian_bits' | |
| /usr/local/rbenv/versions/jruby-1.7.8/lib/ruby/gems/shared/gems/bindata-1.4.5/lib/bindata/io.rb:156:in `writebits' | |
| (eval):7:in `do_write' | |
| /usr/local/rbenv/versions/jruby-1.7.8/lib/ruby/gems/shared/gems/bindata-1.4.5/lib/bindata/struct.rb:217:in `do_write' | |
| org/jruby/RubyArray.java:1613:in `each' | |
| /usr/local/rbenv/versions/jruby-1.7.8/lib/ruby/gems/shared/gems/bindata-1.4.5/lib/bindata/struct.rb:217:in `do_write' | |
| /usr/local/rbenv/versions/jruby-1.7.8/lib/ruby/gems/shared/gems/bindata-1.4.5/lib/bindata/base.rb:184:in `write' | |
| /usr/local/rbenv/versions/jruby-1.7.8/lib/ruby/gems/shared/gems/bindata-1.4.5/lib/bindata/base.rb:197:in `to_binary_s' |