Showing posts with label performance. Show all posts
Showing posts with label performance. Show all posts

Tuesday, December 8, 2009

comparing ruby 1.9 performance on ec2

benchmarked using ruby's benchmarking suite. all machine are brand new fedora 8 basic instances, not running any additional services. all tests done on ruby 1.9.1p376 (2009-12-07 revision 26041) [i686-linux] compiled from source with --enable-shared flag. benchmarks performed twice on 2 separate instances.

results speak for themselves, don't forget to compare ec2 pricing ;)



  small 32 bit medium 32 bit large 64 bit
test run 1 run 2 avg run 1 run 2 avg run 1 run 2 avg
app_answer 0.251 0.263 0.257 0.113 0.118 0.1155 0.087 0.111 0.099
app_erb 2.926 2.911 2.9185 1.2 1.24 1.22 1.178 1.184 1.181
app_factorial 1.425 1.435 1.43 0.573 0.574 0.5735 0.445 0.459 0.452
app_fib 2.935 3.071 3.003 1.248 1.291 1.2695 1.137 1.158 1.1475
app_mandelbrot 1.343 1.348 1.3455 0.566 0.569 0.5675 0.545 0.561 0.553
app_pentomino 99.62 99.227 99.4235 41.587 41.832 41.7095 38.587 38.976 38.7815
app_raise 3.155 3.087 3.121 1.309 1.326 1.3175 1.488 1.521 1.5045
app_strconcat 2.714 2.754 2.734 1.173 1.189 1.181 1.001 1.07 1.0355
app_tak 4.161 4.174 4.1675 1.743 1.756 1.7495 1.52 1.57 1.545
app_tarai 3.194 3.164 3.179 1.364 1.392 1.378 1.23 1.281 1.2555
app_uri 5.652 5.657 5.6545 2.372 2.381 2.3765 2.456 2.412 2.434
io_file_create 1.345 1.351 1.348 0.579 0.569 0.574 0.872 0.891 0.8815
io_file_read 1.379 1.372 1.3755 0.652 0.678 0.665 0.757 0.737 0.747
io_file_write 1.086 1.124 1.105 0.503 0.514 0.5085 0.394 0.413 0.4035
loop_for 8.137 8.393 8.265 3.485 3.685 3.585 2.924 2.924 2.924
loop_generator 2.993 3.061 3.027 1.301 1.305 1.303 1.274 1.278 1.276
loop_times 7.592 6.963 7.2775 3.423 2.857 3.14 2.614 2.657 2.6355
loop_whileloop 3.335 3.449 3.392 1.463 1.476 1.4695 1.067 1.059 1.063
loop_whileloop2 0.7 0.725 0.7125 0.33 0.327 0.3285 0.23 0.227 0.2285
so_ackermann 3.488 3.431 3.4595 1.459 1.479 1.469 1.321 1.336 1.3285
so_array 8.03 8.002 8.016 3.445 3.477 3.461 3.015 3.077 3.046
so_binary_trees 2.21 2.157 2.1835 0.892 0.905 0.8985 0.853 0.864 0.8585
so_concatenate 2.426 2.334 2.38 1.004 1.026 1.015 0.862 0.86 0.861
so_count_words 1.534 1.583 1.5585 0.682 0.698 0.69 0.631 0.628 0.6295
so_exception 6.177 5.951 6.064 2.483 2.473 2.478 2.754 2.712 2.733
so_fannkuch 122.375 122.345 122.36 51.535 51.816 51.6755 54.612 55.241 54.9265
so_fasta 16.102 15.909 16.0055 6.739 6.653 6.696 6.712 6.567 6.6395
so_k_nucleotide 9.231 9.204 9.2175 4.021 3.972 3.9965 3.861 3.895 3.878
so_lists 1.851 1.996 1.9235 0.855 0.845 0.85 0.782 0.778 0.78
so_mandelbrot 49.539 49.33 49.4345 20.966 21.093 21.0295 19.441 19.679 19.56
so_matrix 2.18 2.234 2.207 0.945 0.978 0.9615 0.819 0.858 0.8385
so_meteor_contest 31.53 31.425 31.4775 13.338 13.479 13.4085 12.317 12.254 12.2855
so_nbody 43.097 42.141 42.619 18.029 18.12 18.0745 18.64 18.931 18.7855
so_nested_loop 6.564 6.656 6.61 2.668 2.796 2.732 2.219 2.275 2.247
so_nsieve 15.524 15.361 15.4425 6.54 6.718 6.629 6.526 6.544 6.535
so_nsieve_bits 20.059 20.106 20.0825 8.496 8.534 8.515 6.785 7.031 6.908
so_object 4.818 4.795 4.8065 2.066 2.068 2.067 1.844 1.825 1.8345
so_partial_sums 56.984 57.449 57.2165 24.446 24.164 24.305 24.598 24.707 24.6525
so_pidigits 9.494 9.554 9.524 3.944 3.925 3.9345 2.865 2.846 2.8555
so_random 2.318 2.349 2.3335 0.992 1.016 1.004 0.915 0.941 0.928
so_reverse_complement 26.634 31.414 29.024 11.043 11.656 11.3495 12.476 12.484 12.48
so_sieve 0.428 0.452 0.44 0.21 0.227 0.2185 0.135 0.169 0.152
so_spectralnorm 22.134 22.296 22.215 9.6 9.451 9.5255 8.536 8.462 8.499
vm1_block* 7.212 7.208 7.21 3.409 3.134 3.2715 2.769 2.819 2.794
vm1_const* 2.143 1.988 2.0655 1.296 0.872 1.084 0.661 0.672 0.6665
vm1_ensure* 0.385 0.368 0.3765 0.15 0.168 0.159 0.143 0.153 0.148
vm1_ivar* 7.196 7.12 7.158 2.989 3.004 2.9965 2.735 2.741 2.738
vm1_ivar_set* 7.063 6.819 6.941 2.803 2.974 2.8885 2.492 2.502 2.497
vm1_length* 3.93 3.694 3.812 1.638 1.678 1.658 1.124 1.159 1.1415
vm1_neq* 2.814 2.818 2.816 1.221 1.236 1.2285 0.887 0.888 0.8875
vm1_not* 1.531 1.526 1.5285 0.651 0.702 0.6765 0.519 0.547 0.533
vm1_rescue* 0.324 0.208 0.266 0.133 0.153 0.143 0.112 0.144 0.128
vm1_simplereturn* 4.372 5.532 4.952 1.929 2.352 2.1405 1.731 1.661 1.696
vm1_swap* 1.714 1.631 1.6725 0.73 0.724 0.727 0.484 0.522 0.503
vm2_array* 2.747 2.719 2.733 1.164 1.142 1.153 1.034 1.04 1.037
vm2_case* 0.591 0.6 0.5955 0.254 0.259 0.2565 0.256 0.275 0.2655
vm2_eval* 102.12 104.003 103.0615 42.756 42.905 42.8305 42.582 43.292 42.937
vm2_method* 6.839 7.739 7.289 2.926 2.914 2.92 2.515 2.531 2.523
vm2_mutex* 6.675 6.75 6.7125 2.827 2.857 2.842 2.435 2.381 2.408
vm2_poly_method* 10.517 10.217 10.367 4.385 4.578 4.4815 3.747 3.577 3.662
vm2_poly_method_ov* 0.905 0.821 0.863 0.357 0.408 0.3825 0.385 0.412 0.3985
vm2_proc* 2.923 2.917 2.92 1.31 1.219 1.2645 1.118 1.115 1.1165
vm2_regexp* 7.88 7.773 7.8265 3.438 3.377 3.4075 2.713 2.722 2.7175
vm2_send* 1.066 1.085 1.0755 0.463 0.463 0.463 0.427 0.428 0.4275
vm2_super* 1.866 1.87 1.868 0.788 0.869 0.8285 0.696 0.735 0.7155
vm2_unif1* 0.845 0.884 0.8645 0.41 0.415 0.4125 0.343 0.368 0.3555
vm2_zsuper* 1.937 2.042 1.9895 0.821 0.849 0.835 0.742 0.777 0.7595
vm3_gc 5.348 5.301 5.3245 2.234 2.251 2.2425 2.357 2.366 2.3615
vm3_thread_create_join 5.113 5.263 5.188 2.353 2.289 2.321 3.317 3.288 3.3025
vm3_thread_mutex 1.818 1.862 1.84 32.556 35.779 34.1675 4.661 6.225 5.443

Thursday, October 1, 2009

Compiling mod_xsendfile on OSX

mod_xsendfile is an apache2 module which come handy when you need to serve static files through a secondary application layer or a proxied web server, both tend to serve static files slower and less efficiently than apache does. In such cases you want to delegate the request (file path) to apache so that the secondary layer/proxied web server are freed to move on and process other requests. A common example is a php download handler that needs to go to the db to fetch the file path, check permissions, etc but don't want to deal with the actual file transfer, another common example is a ruby on rails proxied web server such as mongrel which is slow in serving static files under stress due it's concurrency model and can quickly become a bottle neck. For more information on mod_xsendfile and how to configure it go here.

The above information well known, however mod_xsendfile installation documentation states the following:

1. Grab the source.
2. Compile and install:
>> apxs -cia mod_xsendfile.c
3. Restart apache
4. That's all.

If you try this on OSX the compilation step will fail due to missing architecture flags, hence, use the following instead:

>> apxs -cia -Wc,"-arch x86_64 -arch ppc -arch i386 -arch ppc64" -Wl,"-arch x86_64 -arch ppc -arch i386 -arch ppc64" mod_xsendfile.c

This will compile mod_xsendfile in all 4 OSX flavors, which should cover your case. Naturally, you can change the architecture flag to just the one that is relevant to your hardware. More info here.