Skip to content

Instantly share code, notes, and snippets.

@smetj
smetj / gist:3793111
Created September 27, 2012 09:29
ElasticSearch update script having problems with fields starting with @ sign
Version: 0.19.9
curl -XGET 'http://xxx:9200/_cluster/health?pretty=true'
{
"cluster_name" : "elasticsearch",
"status" : "yellow",
"timed_out" : false,
"number_of_nodes" : 2,
"number_of_data_nodes" : 1,
"active_primary_shards" : 85,
@smetj
smetj / gist:3823716
Created October 2, 2012 22:25
Check speed of dict lookups with 10000000 iterations
https://github.com/smetj/experiments/blob/master/python/testlap/dict_eval.py
[smetj@indigo python]$ python speed_test_dict_eval.py
Running test_1
OK
Running test_2
OK
Running test_3
OK
Running test_4
@smetj
smetj / gist:3935398
Created October 22, 2012 23:19
Compare speed between "piping stdout over nc" or "write directly" to a remote server.
https://github.com/smetj/experiments/blob/master/python/testlap/stdout_vs_socket.py
[smetj@indigo python]$ python compare_stdout_socket.py 2> >(nc -w1 -u localhost 10000)
Running test_1
OK
Running test_2
OK
2.7.3 (default, Jul 24 2012, 10:05:38)
[GCC 4.7.0 20120507 (Red Hat 4.7.0-5)]
Linux-3.6.2-4.fc17.x86_64-x86_64-with-fedora-17-Beefy_Miracle
@smetj
smetj / gist:3993851
Created November 1, 2012 14:13
Compare speed of direct queue to queue connections vs. 1 big queue with routing logic.
https://github.com/smetj/experiments/blob/master/python/testlap/compare_direct_q_vs_routing_logic.py
[vagrant@buildbox testlap]$ python compare_direct_q_vs_routing_logic.py
Running test_1
OK
Running test_2
OK
2.6.6 (r266:84292, Sep 11 2012, 08:34:23)
[GCC 4.4.6 20120305 (Red Hat 4.4.6-4)]
Linux-2.6.32-279.11.1.el6.x86_64-x86_64-with-centos-6.3-Final
@smetj
smetj / gist:4004937
Created November 2, 2012 23:15
Message IO with Wishbone and RabbitMQ
https://github.com/smetj/experiments/blob/master/python/rabbitmq_io.py
Instances Prefetch_count Acknowledge Msg/sec
1 100 Yes ~ 1100
1 100 No ~ 2020
2 100 Yes ~ 1800
2 100 No ~ 3200
@smetj
smetj / gist:4042390
Created November 8, 2012 22:52
A "Tipping Bucket" buffer for WishBone.
https://github.com/smetj/experiments/blob/master/python/wishbone/tippingbucket/tippingbuckettest.py
[root@sandbox tippingbucket]# ./tippingbuckettest.py debug --config tippingbuckettest.cfg
2012-11-11 23:21:57,743 INFO Server: Starting TippingBucketTest in foreground.
2012-11-11 23:21:57,745 INFO Server: Instance #0 started.
2012-11-11 23:21:57,746 INFO Server: Started with pids: 21325, 21326
2012-11-11 23:21:57,765 INFO Intance #0:inputgenerator: Initiated
2012-11-11 23:21:57,767 INFO Intance #0:tippingbucket: Initiated.
2012-11-11 23:21:57,767 INFO Intance #0:gotmessage: Initiated.
2012-11-11 23:21:57,768 INFO Intance #0:inputgenerator: Next outage is planned at Sun, 11 Nov 2012 23:22:04 +0000
@smetj
smetj / gist:4133212
Created November 22, 2012 22:49
Wishbone metrics
[root@sandbox tippingbucket]# ./tippingbuckettest debug --config tippingbuckettest.json
2012-11-22 23:47:26,748 INFO Server: Starting TippingBucketTest in foreground.
2012-11-22 23:47:26,751 INFO Server: Instance #0 started.
2012-11-22 23:47:26,752 INFO Server: Started with pids: 4956, 4957
2012-11-22 23:47:26,763 INFO Intance #0:tippingbucket: Initiated.
2012-11-22 23:47:26,772 INFO Intance #0:inputgenerator: Initiated
2012-11-22 23:47:26,772 INFO Intance #0:gotmessage: Initiated.
2012-11-22 23:47:26,773 INFO Intance #0:inputgenerator: Next outage is planned at Thu, 22 Nov 2012 23:47:32 +0000
2012-11-22 23:47:26,774 INFO Intance #0:gotmessage: Started.
2012-11-22 23:47:26,774 INFO Intance #0:tippingbucket: Started.
@smetj
smetj / gist:4253033
Created December 10, 2012 20:12
Measure impact of constantly initializing classes.
https://github.com/smetj/experiments/blob/master/python/testlap/measure_class_init_impact.py
[smetj@indigo testlap]$ python measure_class_init_impact.py
Running test_1
OK
Running test_2
OK
2.7.3 (default, Jul 24 2012, 10:05:38)
[GCC 4.7.0 20120507 (Red Hat 4.7.0-5)]
Linux-3.6.6-1.fc17.x86_64-x86_64-with-fedora-17-Beefy_Miracle
@smetj
smetj / gist:5051568
Last active December 14, 2015 07:38
Comparing hits per second using DictGenerator between WishBone 0.2 and WishBone 0.3
[smetj@sandbox]# ./wishbone debug --config dictgen_v0.2.json
Function metrics:
+-----------------+----------+------------+-----------------+--------+--------------+
| Instance | Function | Total time | Hits per second | Hits | Average time |
+-----------------+----------+------------+-----------------+--------+--------------+
| Intance #0:null | consume | 2.296784 | 4342 | 224780 | 1e-05 |
+-----------------+----------+------------+-----------------+--------+--------------+
Connector metrics:
https://github.com/smetj/experiments/blob/master/python/testlap/queue_vs_deque_vs_mxstack.py
2.7.3 (default, Aug 9 2012, 17:23:57)
[GCC 4.7.1 20120720 (Red Hat 4.7.1-5)]
Linux-3.8.11-200.fc18.x86_64-x86_64-with-fedora-18-Spherical_Cow
Compare IO speed of different queue implementations.
Pushing and popping 1000000 integers.