Freeswitcher 0.4.4 Released, and welcome Harry

Posted by Bougyman Sun, 06 Dec 2009 20:44:00 GMT

This is a fairly minor bugfix (thanks diegoviela) to fix the Playback app. The 0.4.4 should be available via gem.

Mostly i'm sorry this blog has been so idle, we've been working hard on FSR, FXC, and related components, but much of it on commercial or proprietary projects. In the coming months we'll be using this knowledge to release applications which enhance the functionality of open source telecom.

Thanks to all the new contributors, and welcome to the core team Harry Vandberg. He's pushed development along while we played end user for a few months, we're happy to have him.

Rack::Utils and CGI escape and unescape performance boost

Posted by JVaughn Wed, 24 Jun 2009 20:09:00 GMT

As performance boosts are about speed, we’ll start with the benchmarks. Here is a run of spec/bench.rb, from the url_escape source tree.

Escape

- user system total real
URLEscape::escape 0.200000 0.000000 0.200000 ( 0.196100)
CGI::escape 3.830000 0.010000 3.840000 ( 3.828438)
Rack::Utils::escape 3.880000 0.010000 3.890000 ( 3.880745)


Unescape

- user system total real
URLEscape::unescape 0.090000 0.000000 0.090000 ( 0.089190)
CGI::unescape 2.820000 0.000000 2.820000 ( 2.816234)
Rack::Utils::unescape 3.140000 0.000000 3.140000 ( 3.137291)


URLEscape provides these two methods as a C extension, suitable for use on ruby 1.8.6-8 and 1.9.1+; tested on linux, XP, and Vista.
The jruby version uses the java stdlib’s java.net.URLEncoder and URLDecoder. We only see a 200-700% increase with this change, and would like to improve on those numbers.

Why?

Josh Susser initially noticed the ability to overload #escape and #unescape while testing a client application. At the same time, we had just come across a bottleneck when regression testing FXC (a web app which serves configuration information to the FreeSWITCH softswitch) where requests were being delayed in our rack middleware, which parses the POST data sent by FreeSWITCH and routes requests to the ramaze application for processing. The delay was noticeable under loads of only 50 req/second; where rack became the bottleneck, not ramaze, the db, or any other factor. Adding the above library (on linux, with ruby 1.9.1) removed the delay in rack, pushing the work back to to the web app (or database) where it’s free to be as slow as it must. Optimally we’d like to perform at a speed equal to the database, making it the final bottleneck in a dynamic application.

Installation and Usage

To use URLEscape standalone

Install with one of the following methods:

  • gem install url_escape
  • get the tarball from RubyForge
  • get the source from GitHub and rake install in the source top-level.

Then simply require “url_escape” and you have access to URLEscape.escape(string) and URLEscape.unescape(string)

To use URLEscape’s escape/unescape in place of CGI or Rack::Utils versions

gem install rackfastescape

or

gem install cgifastescape

This will install url_escape if it’s not already installed, as well.

You can optionally install rackfastescape or cgifastescape from rubyforge’s tarball or the github source (rake install as with urlescape). If you use tarball or source rake install, *you will have to manually install urlescape first.*

Once installed, simply use

require "rack_fast_escape"

to replace Rack::Utils version, or

require "cgi_fast_escape"

to replace the CGI version.

What else?

The ability of large posts to slow down a web application cannot be removed by just speeding up the POST parser. In order to alleviate the risk of such large POSTs being used to deny a service, firewall or web server throttling or limiting is a more reliable protection to enable. Here are a few examples:

  • Lighttpd: http://lighttpd.net

    • Offers mod_evasive which limits connections per ip, as well as the ability to limit the data rate per connection.
  • Nginx: http://nginx.org

    • Flexible limiting system, per vhost, per user, per connection.
  • Netfilter/QoS (linux): http://l7-filter.sourceforge.net/

    • Allow classifiation of HTTP packets so iptables/tc or whatever utility you’d like can have the info it needs about the HTTP protocol to make limiting/dropping/queueing decisions

    • Others: Apache, Squid, Litespeed, many others will have various methods of limiting size and frequency of requests.

Side Note

When speccing these libraries, a few implementation differences came to light which we’ll highlight here.

  1. Rack::Utils and CGI both throw errors on a mixed ASCII and Unicode string in ruby 1.9.1 and above
  2. Java’s URLDecoder and URLEncoder do not escape or unescape mixed ASCII/Unicode properly.

URLEscape (the C version) handles these cases properly, though we don’t expect you’d see them much in proper requests.

Thanks

To Evan Phoenix, Josh Susser, Trey Dempsey, Jayson Vaughn, Michael Fellinger, Kevin Berry, and all the other contributors of ideas and support who made this product a reality.

License

Nothing to fear, it’s MIT

Drivel Blog Client

Posted by Bougyman Wed, 11 Jun 2008 14:12:49 GMT

Testing a new blog client. Vimperator (mozilla plugin to give VIM modes in the web browser) isn’t playing well with typo’s real-time preview in posts; plus I wanted to see if desktop blogging was better than I experienced before (BloGTK). Drivel seems more minimal (I like that).

New blog up!

Posted by Bougyman Wed, 11 Jun 2008 13:40:00 GMT

How bout that typo? Love the easy install, but wish it wouldn’t be so mongrel-centric. eM.A.S.H. was able to successfully deploy a vanilla Typo install, only change necessary was to the installer/rails-installer.yml file to get rid of the high port specification.