# Server Programming

**URL:** <https://rubytalk.org/t/server-programming/14380>\
**Category:** ruby-talk\
**Created:** [25 October 2004 16:08 UTC](https://rubytalk.org/t/server-programming/14380 "2004-10-25T16:08:41Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andy\_Stone](https://avatars.discourse-cdn.com/v4/letter/a/94ad74/32.png) [@Andy\_Stone](https://rubytalk.org/u/Andy_Stone)\
**Post date:** [25 October 2004 16:08 UTC](https://rubytalk.org/t/server-programming/14380/1 "2004-10-25T16:08:41Z")

</div>

Hello all,

The company I work for currently utilizes JAVA/JSP, ORACLE 9i,  
Apache,Tomcat setup running on Solaris. We have plans to migrate to  
PostgreSQL and Linux. Currently I have an issue with a server written  
in JAVA that hangs about once a week (don't know exactly why yet -  
hence the vague term) and we recently had it create a defunct port  
while trying to shut down. I did not write this server, but am the  
only one left to maintain this code.

Now you know why I am here. I am looking into Ruby as an alternative  
to this JAVA Server. The core functionality needed would be processing  
zip files, parsing text/binary files and executing sql statements.

At this stage, how does Ruby compare to Java in terms of server  
programming? I have liked everything I've read about Ruby to date,  
but have seen very little in reference to server programming, but then  
again, I'm just beginning.

Please excuse the vagueness, I'm very undecided what to do right now,  
rewrite the JAVA Server in another language or rewrite it with JAVA,  
but correctly. The main reason for the other language consideration  
is the text and binary file processing. I'm was thinking Ruby might  
handle this aspect better than JAVA.

thanks,  
andy

---

<div class="post-metadata">

**Author:** ![Francis\_Hwang1](https://avatars.discourse-cdn.com/v4/letter/f/ecae2f/32.png) [@Francis\_Hwang1](https://rubytalk.org/u/Francis_Hwang1)\
**Post date:** [25 October 2004 23:39 UTC](https://rubytalk.org/t/server-programming/14380/2 "2004-10-25T23:39:50Z")

</div>

Hi Andy,

What's the server part of this? I understand processing zip files, parsing text/binary, executing SQL, all of that, but I think you've been a little vague as to how all these actions fit into the overall function of the server in your company. Is this a web server, then I take it? Or some other sort of server?

At any rate, everything you've said so far can be handled fine in Ruby, and you'll probably find it a lot more fun to write than in Java. If you have other specific concerns you should just bring them up and we can address them.

Francis

> **···**
>
> On Oct 25, 2004, at 12:08 PM, Andy Stone wrote:
> 
> > Hello all,
> > 
> > The company I work for currently utilizes JAVA/JSP, ORACLE 9i,  
> > Apache,Tomcat setup running on Solaris. We have plans to migrate to  
> > PostgreSQL and Linux. Currently I have an issue with a server written  
> > in JAVA that hangs about once a week (don't know exactly why yet -  
> > hence the vague term) and we recently had it create a defunct port  
> > while trying to shut down. I did not write this server, but am the  
> > only one left to maintain this code.
> > 
> > Now you know why I am here. I am looking into Ruby as an alternative  
> > to this JAVA Server. The core functionality needed would be processing  
> > zip files, parsing text/binary files and executing sql statements.
> > 
> > At this stage, how does Ruby compare to Java in terms of server  
> > programming? I have liked everything I've read about Ruby to date,  
> > but have seen very little in reference to server programming, but then  
> > again, I'm just beginning.
> > 
> > Please excuse the vagueness, I'm very undecided what to do right now,  
> > rewrite the JAVA Server in another language or rewrite it with JAVA,  
> > but correctly. The main reason for the other language consideration  
> > is the text and binary file processing. I'm was thinking Ruby might  
> > handle this aspect better than JAVA.
> > 
> > thanks,  
> > andy

---

<div class="post-metadata">

**Author:** ![Dido\_Sevilla](https://avatars.discourse-cdn.com/v4/letter/d/9dc877/32.png) [@Dido\_Sevilla](https://rubytalk.org/u/Dido_Sevilla)\
**Post date:** [26 October 2004 00:45 UTC](https://rubytalk.org/t/server-programming/14380/3 "2004-10-26T00:45:06Z")

</div>

> Now you know why I am here. I am looking into Ruby as an alternative  
> to this JAVA Server. The core functionality needed would be processing  
> zip files, parsing text/binary files and executing sql statements.

This is all par for the course. Ruby is very much capable of all these  
things, but there are certain DBD's that aren't as well maintained as  
others, so knowing what your database backend is would be useful  
(specifically it would appear that the Sybase driver is woefully out  
of date).

Ruby is in my opinion a much, much more elegantly pleasant language to  
work with than Java will ever be.

> At this stage, how does Ruby compare to Java in terms of server  
> programming?

I assume you mean web server programming. More generic application  
server programming is also doable and most of the common protocols  
already have direct support by the Ruby core (e.g. http, smtp,  
pop/imap, and so forth).

> I have liked everything I've read about Ruby to date,  
> but have seen very little in reference to server programming, but then  
> again, I'm just beginning.

Try going to [http://www.rubyonrails.org/](http://www.rubyonrails.org/)

It's an MVC framework like the Apache Project's Jakarta Struts, but it  
is in my experience a lot simpler and easier to program in. As they  
put it, you'll be able to build a full-featured web application using  
less lines of code than many other frameworks use for their XML  
configuration files...

> **···**
>
> On Tue, 26 Oct 2004 01:08:41 +0900, Andy Stone \<xsltguru@gmail.com\> wrote:

---

<div class="post-metadata">

**Author:** ![Andy\_Stone](https://avatars.discourse-cdn.com/v4/letter/a/94ad74/32.png) [@Andy\_Stone](https://rubytalk.org/u/Andy_Stone)\
**Post date:** [26 October 2004 01:03 UTC](https://rubytalk.org/t/server-programming/14380/4 "2004-10-26T01:03:13Z")

</div>

Hello Francis,

Thanks for the reply.

This isn't a web server, just a JAVA client/server application that  
starts a few threads that have their own individual responsibilities.  
The server app is merely a container for these threads to allow the  
basic functions like startup,shutdown,and status to be handled  
cleanly.

Being that I don't have any specific questions, I'll just start  
writing a version in Ruby and will post questions (as they arise) to  
answers I can't find elsewhere.

Thanks again,  
andy

> **···**
>
> On Tue, 26 Oct 2004 08:39:50 +0900, Francis Hwang \<sera@fhwang.net\> wrote:
> 
> > Hi Andy,
> > 
> > What's the server part of this? I understand processing zip files,  
> > parsing text/binary, executing SQL, all of that, but I think you've  
> > been a little vague as to how all these actions fit into the overall  
> > function of the server in your company. Is this a web server, then I  
> > take it? Or some other sort of server?
> > 
> > At any rate, everything you've said so far can be handled fine in Ruby,  
> > and you'll probably find it a lot more fun to write than in Java. If  
> > you have other specific concerns you should just bring them up and we  
> > can address them.
> > 
> > Francis
> > 
> > On Oct 25, 2004, at 12:08 PM, Andy Stone wrote:
> > 
> > \> Hello all,  
> > \>  
> > \> The company I work for currently utilizes JAVA/JSP, ORACLE 9i,  
> > \> Apache,Tomcat setup running on Solaris. We have plans to migrate to  
> > \> PostgreSQL and Linux. Currently I have an issue with a server written  
> > \> in JAVA that hangs about once a week (don't know exactly why yet -  
> > \> hence the vague term) and we recently had it create a defunct port  
> > \> while trying to shut down. I did not write this server, but am the  
> > \> only one left to maintain this code.  
> > \>  
> > \> Now you know why I am here. I am looking into Ruby as an alternative  
> > \> to this JAVA Server. The core functionality needed would be processing  
> > \> zip files, parsing text/binary files and executing sql statements.  
> > \>  
> > \> At this stage, how does Ruby compare to Java in terms of server  
> > \> programming? I have liked everything I've read about Ruby to date,  
> > \> but have seen very little in reference to server programming, but then  
> > \> again, I'm just beginning.  
> > \>  
> > \> Please excuse the vagueness, I'm very undecided what to do right now,  
> > \> rewrite the JAVA Server in another language or rewrite it with JAVA,  
> > \> but correctly. The main reason for the other language consideration  
> > \> is the text and binary file processing. I'm was thinking Ruby might  
> > \> handle this aspect better than JAVA.  
> > \>  
> > \> thanks,  
> > \> andy  
> > \>

---

<div class="post-metadata">

**Author:** ![Andy\_Stone](https://avatars.discourse-cdn.com/v4/letter/a/94ad74/32.png) [@Andy\_Stone](https://rubytalk.org/u/Andy_Stone)\
**Post date:** [26 October 2004 01:14 UTC](https://rubytalk.org/t/server-programming/14380/5 "2004-10-26T01:14:43Z")

</div>

Thanks for the reply Dido,

My hope is that Ruby is not only a a more elegant and easier language  
to use, but will also handle this task more efficiently with fewer  
issues than I currently have. Of course that is very touch metric  
because the problems with the current Java implementation could have  
nothing to do with Java, just bad code.

As I just replied to Francis, I will just jump into this and see what happens.

I guess I'm just bored with Java, have an issue that needs fixing and  
am looking for a change.

thanks again,  
andy

> **···**
>
> On Tue, 26 Oct 2004 09:45:06 +0900, Dido Sevilla \<dido.sevilla@gmail.com\> wrote:
> 
> > On Tue, 26 Oct 2004 01:08:41 +0900, Andy Stone \<xsltguru@gmail.com\> wrote:  
> > \> Now you know why I am here. I am looking into Ruby as an alternative  
> > \> to this JAVA Server. The core functionality needed would be processing  
> > \> zip files, parsing text/binary files and executing sql statements.  
> > \>
> > 
> > This is all par for the course. Ruby is very much capable of all these  
> > things, but there are certain DBD's that aren't as well maintained as  
> > others, so knowing what your database backend is would be useful  
> > (specifically it would appear that the Sybase driver is woefully out  
> > of date).
> > 
> > Ruby is in my opinion a much, much more elegantly pleasant language to  
> > work with than Java will ever be.
> > 
> > \> At this stage, how does Ruby compare to Java in terms of server  
> > \> programming?
> > 
> > I assume you mean web server programming. More generic application  
> > server programming is also doable and most of the common protocols  
> > already have direct support by the Ruby core (e.g. http, smtp,  
> > pop/imap, and so forth).
> > 
> > \> I have liked everything I've read about Ruby to date,  
> > \> but have seen very little in reference to server programming, but then  
> > \> again, I'm just beginning.  
> > \>
> > 
> > Try going to [http://www.rubyonrails.org/](http://www.rubyonrails.org/)
> > 
> > It's an MVC framework like the Apache Project's Jakarta Struts, but it  
> > is in my experience a lot simpler and easier to program in. As they  
> > put it, you'll be able to build a full-featured web application using  
> > less lines of code than many other frameworks use for their XML  
> > configuration files...

---

<div class="post-metadata">

**Author:** ![David\_Ross](https://avatars.discourse-cdn.com/v4/letter/d/8e8cbc/32.png) [@David\_Ross](https://rubytalk.org/u/David_Ross)\
**Post date:** [26 October 2004 01:13 UTC](https://rubytalk.org/t/server-programming/14380/6 "2004-10-26T01:13:19Z")

</div>

My project usage with Ruby comes pretty close to what you are using it for with your project.

Recently I created a SOAP client/server which were seperate handling frontend and backend for customers to access company information. The program handled authentication, database access, and scripts that ran every night updating any information changed from external data formats. Ruby runs fine for server/client applications. I hgive it a big A+. I've had a few problems sure, but the Japanese Ruby community are really nice. There are some nice non-ignorant people out there as well, usually you can find them on IRC(note: there are still ignorant ones out there). Thanks to NaHi I was able to complete my applications. Ruby is very good for what ou have in mind.

If you need help, drop by on  
irc://irc.efnet.net/ruby-lang  
or  
irc://irc.freenode.net/rubymine

I would be glad to answer any questions you have.

David Ross

> **···**
>
> --  
> Hazzle free packages for Ruby?  
> RPA is available from [http://www.rubyarchive.org/](http://www.rubyarchive.org/)
> 
> Andy Stone wrote:
> 
> > Hello Francis,
> > 
> > Thanks for the reply.
> > 
> > This isn't a web server, just a JAVA client/server application that  
> > starts a few threads that have their own individual responsibilities. The server app is merely a container for these threads to allow the  
> > basic functions like startup,shutdown,and status to be handled  
> > cleanly.
> > 
> > Being that I don't have any specific questions, I'll just start  
> > writing a version in Ruby and will post questions (as they arise) to  
> > answers I can't find elsewhere.
> > 
> > Thanks again,  
> > andy
> > 
> > On Tue, 26 Oct 2004 08:39:50 +0900, Francis Hwang \<sera@fhwang.net\> wrote:
> > 
> > > Hi Andy,
> > > 
> > > What's the server part of this? I understand processing zip files,  
> > > parsing text/binary, executing SQL, all of that, but I think you've  
> > > been a little vague as to how all these actions fit into the overall  
> > > function of the server in your company. Is this a web server, then I  
> > > take it? Or some other sort of server?
> > > 
> > > At any rate, everything you've said so far can be handled fine in Ruby,  
> > > and you'll probably find it a lot more fun to write than in Java. If  
> > > you have other specific concerns you should just bring them up and we  
> > > can address them.
> > > 
> > > Francis
> > > 
> > > On Oct 25, 2004, at 12:08 PM, Andy Stone wrote:
> > > 
> > > > Hello all,
> > > > 
> > > > The company I work for currently utilizes JAVA/JSP, ORACLE 9i,  
> > > > Apache,Tomcat setup running on Solaris. We have plans to migrate to  
> > > > PostgreSQL and Linux. Currently I have an issue with a server written  
> > > > in JAVA that hangs about once a week (don't know exactly why yet -  
> > > > hence the vague term) and we recently had it create a defunct port  
> > > > while trying to shut down. I did not write this server, but am the  
> > > > only one left to maintain this code.
> > > > 
> > > > Now you know why I am here. I am looking into Ruby as an alternative  
> > > > to this JAVA Server. The core functionality needed would be processing  
> > > > zip files, parsing text/binary files and executing sql statements.
> > > > 
> > > > At this stage, how does Ruby compare to Java in terms of server  
> > > > programming? I have liked everything I've read about Ruby to date,  
> > > > but have seen very little in reference to server programming, but then  
> > > > again, I'm just beginning.
> > > > 
> > > > Please excuse the vagueness, I'm very undecided what to do right now,  
> > > > rewrite the JAVA Server in another language or rewrite it with JAVA,  
> > > > but correctly. The main reason for the other language consideration  
> > > > is the text and binary file processing. I'm was thinking Ruby might  
> > > > handle this aspect better than JAVA.
> > > > 
> > > > thanks,  
> > > > andy

---

<div class="post-metadata">

**Author:** ![Joel\_VanderWerf1](https://avatars.discourse-cdn.com/v4/letter/j/94ad74/32.png) [@Joel\_VanderWerf1](https://rubytalk.org/u/Joel_VanderWerf1)\
**Post date:** [26 October 2004 01:17 UTC](https://rubytalk.org/t/server-programming/14380/7 "2004-10-26T01:17:40Z")

</div>

Andy Stone wrote:

> Hello Francis,
> 
> Thanks for the reply.
> 
> This isn't a web server, just a JAVA client/server application that  
> starts a few threads that have their own individual responsibilities. The server app is merely a container for these threads to allow the  
> basic functions like startup,shutdown,and status to be handled  
> cleanly.

Note that ruby threads are in-process threads, so if you're using threads to take advantage of multiple cpus, you may want to have several ruby processes on the server side, and distribute tasks among them.

Also, take a loook at DRb--distributed ruby. It's a remote method call protocol for ruby objects and a very elegant way of developing servers, though it doesn't come without some performance costs. A good starting place is the pickaxe book (get it online at [http://www.rubycentral.com/book/index.html](http://www.rubycentral.com/book/index.html) or buy the new edition).

DRb even has a Linda/tuplespace implementation, called Rinda. All included with ruby in the standard lib.

---

<div class="post-metadata">

**Author:** ![Andy\_Stone](https://avatars.discourse-cdn.com/v4/letter/a/94ad74/32.png) [@Andy\_Stone](https://rubytalk.org/u/Andy_Stone)\
**Post date:** [26 October 2004 01:18 UTC](https://rubytalk.org/t/server-programming/14380/8 "2004-10-26T01:18:59Z")

</div>

David,

Thanks for your reply. It's very good to hear that!

I'll only bug you guys if I've exhausted everything else. 🙂

thanks again! It's real nice to see this kind of response.

-andy

> **···**
>
> On Tue, 26 Oct 2004 10:13:19 +0900, David Ross \<dross@code-exec.net\> wrote:
> 
> > My project usage with Ruby comes pretty close to what you are using it  
> > for with your project.
> > 
> > Recently I created a SOAP client/server which were seperate handling  
> > frontend and backend for customers to access company information. The  
> > program handled authentication, database access, and scripts that ran  
> > every night updating any information changed from external data formats.  
> > Ruby runs fine for server/client applications. I hgive it a big A+. I've  
> > had a few problems sure, but the Japanese Ruby community are really  
> > nice. There are some nice non-ignorant people out there as well, usually  
> > you can find them on IRC(note: there are still ignorant ones out there).  
> > Thanks to NaHi I was able to complete my applications. Ruby is very good  
> > for what ou have in mind.
> > 
> > If you need help, drop by on  
> > irc://irc.efnet.net/ruby-lang  
> > or  
> > irc://irc.freenode.net/rubymine
> > 
> > I would be glad to answer any questions you have.
> > 
> > David Ross  
> > --  
> > Hazzle free packages for Ruby?  
> > RPA is available from [http://www.rubyarchive.org/](http://www.rubyarchive.org/)
> > 
> > Andy Stone wrote:
> > 
> > \>Hello Francis,  
> > \>  
> > \>Thanks for the reply.  
> > \>  
> > \>This isn't a web server, just a JAVA client/server application that  
> > \>starts a few threads that have their own individual responsibilities.  
> > \>The server app is merely a container for these threads to allow the  
> > \>basic functions like startup,shutdown,and status to be handled  
> > \>cleanly.  
> > \>  
> > \>Being that I don't have any specific questions, I'll just start  
> > \>writing a version in Ruby and will post questions (as they arise) to  
> > \>answers I can't find elsewhere.  
> > \>  
> > \>  
> > \>Thanks again,  
> > \>andy  
> > \>  
> > \>On Tue, 26 Oct 2004 08:39:50 +0900, Francis Hwang \<sera@fhwang.net\> wrote:  
> > \>  
> > \>  
> > \>\>Hi Andy,  
> > \>\>  
> > \>\>What's the server part of this? I understand processing zip files,  
> > \>\>parsing text/binary, executing SQL, all of that, but I think you've  
> > \>\>been a little vague as to how all these actions fit into the overall  
> > \>\>function of the server in your company. Is this a web server, then I  
> > \>\>take it? Or some other sort of server?  
> > \>\>  
> > \>\>At any rate, everything you've said so far can be handled fine in Ruby,  
> > \>\>and you'll probably find it a lot more fun to write than in Java. If  
> > \>\>you have other specific concerns you should just bring them up and we  
> > \>\>can address them.  
> > \>\>  
> > \>\>Francis  
> > \>\>  
> > \>\>  
> > \>\>  
> > \>\>  
> > \>\>On Oct 25, 2004, at 12:08 PM, Andy Stone wrote:  
> > \>\>  
> > \>\>  
> > \>\>  
> > \>\>\>Hello all,  
> > \>\>\>  
> > \>\>\>The company I work for currently utilizes JAVA/JSP, ORACLE 9i,  
> > \>\>\>Apache,Tomcat setup running on Solaris. We have plans to migrate to  
> > \>\>\>PostgreSQL and Linux. Currently I have an issue with a server written  
> > \>\>\>in JAVA that hangs about once a week (don't know exactly why yet -  
> > \>\>\>hence the vague term) and we recently had it create a defunct port  
> > \>\>\>while trying to shut down. I did not write this server, but am the  
> > \>\>\>only one left to maintain this code.  
> > \>\>\>  
> > \>\>\>Now you know why I am here. I am looking into Ruby as an alternative  
> > \>\>\>to this JAVA Server. The core functionality needed would be processing  
> > \>\>\>zip files, parsing text/binary files and executing sql statements.  
> > \>\>\>  
> > \>\>\>At this stage, how does Ruby compare to Java in terms of server  
> > \>\>\>programming? I have liked everything I've read about Ruby to date,  
> > \>\>\>but have seen very little in reference to server programming, but then  
> > \>\>\>again, I'm just beginning.  
> > \>\>\>  
> > \>\>\>Please excuse the vagueness, I'm very undecided what to do right now,  
> > \>\>\>rewrite the JAVA Server in another language or rewrite it with JAVA,  
> > \>\>\>but correctly. The main reason for the other language consideration  
> > \>\>\>is the text and binary file processing. I'm was thinking Ruby might  
> > \>\>\>handle this aspect better than JAVA.  
> > \>\>\>  
> > \>\>\>thanks,  
> > \>\>\>andy  
> > \>\>\>  
> > \>\>\>  
> > \>\>\>  
> > \>\>  
> > \>\>  
> > \>  
> > \>  
> > \>  
> > \>

---

<div class="post-metadata">

**Author:** ![Andy\_Stone](https://avatars.discourse-cdn.com/v4/letter/a/94ad74/32.png) [@Andy\_Stone](https://rubytalk.org/u/Andy_Stone)\
**Post date:** [26 October 2004 01:42 UTC](https://rubytalk.org/t/server-programming/14380/9 "2004-10-26T01:42:15Z")

</div>

Joel,

Thanks for the thread and DRb info. Performance is a main concern  
with this application, so it doesn't sound like the right course for  
me to take, but I will look into it before ruling it out.

-andy

> **···**
>
> On Tue, 26 Oct 2004 10:17:40 +0900, Joel VanderWerf \<vjoel@path.berkeley.edu\> wrote:
> 
> > Andy Stone wrote:  
> > \> Hello Francis,  
> > \>  
> > \> Thanks for the reply.  
> > \>  
> > \> This isn't a web server, just a JAVA client/server application that  
> > \> starts a few threads that have their own individual responsibilities.  
> > \> The server app is merely a container for these threads to allow the  
> > \> basic functions like startup,shutdown,and status to be handled  
> > \> cleanly.
> > 
> > Note that ruby threads are in-process threads, so if you're using  
> > threads to take advantage of multiple cpus, you may want to have several  
> > ruby processes on the server side, and distribute tasks among them.
> > 
> > Also, take a loook at DRb--distributed ruby. It's a remote method call  
> > protocol for ruby objects and a very elegant way of developing servers,  
> > though it doesn't come without some performance costs. A good starting  
> > place is the pickaxe book (get it online at  
> > [http://www.rubycentral.com/book/index.html](http://www.rubycentral.com/book/index.html) or buy the new edition).
> > 
> > DRb even has a Linda/tuplespace implementation, called Rinda. All  
> > included with ruby in the standard lib.

---

<div class="post-metadata">

**Author:** ![Brian\_Candler](https://avatars.discourse-cdn.com/v4/letter/b/5f9b8f/32.png) [@Brian\_Candler](https://rubytalk.org/u/Brian_Candler)\
**Post date:** [26 October 2004 07:42 UTC](https://rubytalk.org/t/server-programming/14380/10 "2004-10-26T07:42:53Z")

</div>

> Also, take a loook at DRb--distributed ruby. It's a remote method call  
> protocol for ruby objects and a very elegant way of developing servers,  
> though it doesn't come without some performance costs. A good starting  
> place is the pickaxe book (get it online at  
> [http://www.rubycentral.com/book/index.html](http://www.rubycentral.com/book/index.html) or buy the new edition).

Also, there's now a page on the wiki at

> **[WebMD - Better information. Better health.](https://www.webmd.com/?DrbTutorial)**
>
> The leading source for trustworthy and timely health and medical news and information. Providing credible health information, supportive community, and educational services by blending award-winning expertise in content, community services, expert...

---

<div class="post-metadata">

**Author:** ![James\_Edward\_Gray\_II](https://avatars.discourse-cdn.com/v4/letter/j/ea5d25/32.png) [@James\_Edward\_Gray\_II](https://rubytalk.org/u/James_Edward_Gray_II)\
**Post date:** [26 October 2004 01:45 UTC](https://rubytalk.org/t/server-programming/14380/11 "2004-10-26T01:45:44Z")

</div>

Ugh. I hate to throw a bad light on Ruby, but it's probably true that Ruby is generally a little slower than Java in most things. Just want you to be aware of that going into this.

James Edward Gray II

> **···**
>
> On Oct 25, 2004, at 8:42 PM, Andy Stone wrote:
> 
> > Joel,
> > 
> > Thanks for the thread and DRb info. Performance is a main concern  
> > with this application, so it doesn't sound like the right course for  
> > me to take, but I will look into it before ruling it out.

---

<div class="post-metadata">

**Author:** ![Andy\_Stone](https://avatars.discourse-cdn.com/v4/letter/a/94ad74/32.png) [@Andy\_Stone](https://rubytalk.org/u/Andy_Stone)\
**Post date:** [26 October 2004 02:04 UTC](https://rubytalk.org/t/server-programming/14380/12 "2004-10-26T02:04:07Z")

</div>

Would you say it's slower in processing text files? A single file can  
run a few megabytes. That's where I was hoping to gain some speed from  
Ruby. I was thinking that Ruby would be a little slower in other  
aspects, but thought that I would make up considerable ground with the  
parsing process.

> **···**
>
> On Tue, 26 Oct 2004 10:45:44 +0900, James Edward Gray II \<james@grayproductions.net\> wrote:
> 
> > On Oct 25, 2004, at 8:42 PM, Andy Stone wrote:
> > 
> > \> Joel,  
> > \>  
> > \> Thanks for the thread and DRb info. Performance is a main concern  
> > \> with this application, so it doesn't sound like the right course for  
> > \> me to take, but I will look into it before ruling it out.
> > 
> > Ugh. I hate to throw a bad light on Ruby, but it's probably true that  
> > Ruby is generally a little slower than Java in most things. Just want  
> > you to be aware of that going into this.
> > 
> > James Edward Gray II

---

<div class="post-metadata">

**Author:** ![James\_Edward\_Gray\_II](https://avatars.discourse-cdn.com/v4/letter/j/ea5d25/32.png) [@James\_Edward\_Gray\_II](https://rubytalk.org/u/James_Edward_Gray_II)\
**Post date:** [26 October 2004 02:35 UTC](https://rubytalk.org/t/server-programming/14380/13 "2004-10-26T02:35:07Z")

</div>

Speed is a dangerous question always. I'm a skilled Java programmer (day job) and I have to tell you true, I BELIEVE I can write faster Java code. Of course, I can write slower too and I certainly write code faster in Ruby (and have more fun doing it). It's a complex question you ask. Benchmark for sure.

James Edward Gray II

> **···**
>
> On Oct 25, 2004, at 9:04 PM, Andy Stone wrote:
> 
> > Would you say it's slower in processing text files? A single file can  
> > run a few megabytes. That's where I was hoping to gain some speed from  
> > Ruby. I was thinking that Ruby would be a little slower in other  
> > aspects, but thought that I would make up considerable ground with the  
> > parsing process.

---

<div class="post-metadata">

**Author:** ![David\_G\_Andersen](https://avatars.discourse-cdn.com/v4/letter/d/49beb7/32.png) [@David\_G\_Andersen](https://rubytalk.org/u/David_G_Andersen)\
**Post date:** [27 October 2004 01:26 UTC](https://rubytalk.org/t/server-programming/14380/14 "2004-10-27T01:26:25Z")

</div>

On Tue, Oct 26, 2004 at 11:04:07AM +0900, Andy Stone scribed:

> Would you say it's slower in processing text files? A single file can  
> run a few megabytes. That's where I was hoping to gain some speed from  
> Ruby. I was thinking that Ruby would be a little slower in other  
> aspects, but thought that I would make up considerable ground with the  
> parsing process.

Another view on this:

I just rewrote a lot of data processing scripts in Ruby. The  
prior version was a mix of perl with a few speed-critical  
functions implemented as standalone C programs. I \_do\_  
care about speed with these -- a full analysis run on the  
data we've got right now takes about a day and a half -- but  
I also cared a lot about getting the programs done in time  
for a conference deadline. The data is about 32 gigs gzipped.

The new version is about the same speed as the prior version, or  
just a bit slower, because it's done right, and it was easier to  
do right -- but doing line processing with Ruby 1.8 (which doesn't  
have the new oniguruma regexp library) is noticably slower than  
doing the same thing in perl if you're doing a lot of

&nbsp;&nbsp;if (l =~ /pattern/) ...

Doing it right resulted in the memory footprint dropping from  
about 500MB to 7MB, which was pleasant, and avoiding some  
stupidity in the perl code (which was pretty entrenched)  
sped things up enough to compensate for the slowdowns.  
I'm \_very\_ glad I took the time to rewrite it. I had to  
do a few workarounds to avoid particular slowdowns in  
Ruby (see my earlier thread about zlib slowness, in particular),  
but it wasn't onerous.

But if you ignore programmer effort and the possibility  
of better program structure, comparing the raw speed of  
a JITted Java to Ruby is probably going to come down on the  
side of Java. Of course, if you can easily implement your  
"inner loop" functionality in C, you could always quickly  
swig it and 'require' it from within ruby. 🙂

Interested to hear what you think after the project.

&nbsp;&nbsp;-Dave

> **···**
>
> --  
> work: dga@lcs.mit.edu me: dga@pobox.com  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MIT Laboratory for Computer Science [http://www.angio.net/](http://www.angio.net/)

---

<div class="post-metadata">

**Author:** ![Andy\_Stone](https://avatars.discourse-cdn.com/v4/letter/a/94ad74/32.png) [@Andy\_Stone](https://rubytalk.org/u/Andy_Stone)\
**Post date:** [26 October 2004 03:03 UTC](https://rubytalk.org/t/server-programming/14380/15 "2004-10-26T03:03:43Z")

</div>

I agree. In relation to a process, the overall speed can be affected  
by many factors including code design, database design and... I could  
go on, but I'm sure you already know all of this.

If there was a choice, I would trade some speed for reliability any  
day. What good is a super fast process if it crashes from time to  
time?

I heard that comment a lot about writing code faster with Ruby. Which  
is one of the main reasons I am evaluating Ruby. As the sole  
developer at the day job, maintaining two entirely different and in  
some areas, complex web sites along with the intranet, this aspect of  
Ruby could help me out tremendously.

I know there's no "holy grail" for computer languages, but I'm always  
looking. 🙂

> **···**
>
> On Tue, 26 Oct 2004 11:35:07 +0900, James Edward Gray II \<james@grayproductions.net\> wrote:
> 
> > On Oct 25, 2004, at 9:04 PM, Andy Stone wrote:
> > 
> > \> Would you say it's slower in processing text files? A single file can  
> > \> run a few megabytes. That's where I was hoping to gain some speed from  
> > \> Ruby. I was thinking that Ruby would be a little slower in other  
> > \> aspects, but thought that I would make up considerable ground with the  
> > \> parsing process.
> > 
> > Speed is a dangerous question always. I'm a skilled Java programmer  
> > (day job) and I have to tell you true, I BELIEVE I can write faster  
> > Java code. Of course, I can write slower too and I certainly write  
> > code faster in Ruby (and have more fun doing it). It's a complex  
> > question you ask. Benchmark for sure.
> > 
> > James Edward Gray II

---

<div class="post-metadata">

**Author:** ![David\_Ross](https://avatars.discourse-cdn.com/v4/letter/d/8e8cbc/32.png) [@David\_Ross](https://rubytalk.org/u/David_Ross)\
**Post date:** [27 October 2004 01:36 UTC](https://rubytalk.org/t/server-programming/14380/16 "2004-10-27T01:36:08Z")

</div>

David G. Andersen wrote:

> On Tue, Oct 26, 2004 at 11:04:07AM +0900, Andy Stone scribed:
> 
> > Would you say it's slower in processing text files? A single file can  
> > run a few megabytes. That's where I was hoping to gain some speed from  
> > Ruby. I was thinking that Ruby would be a little slower in other  
> > aspects, but thought that I would make up considerable ground with the  
> > parsing process.  
> > &nbsp;&nbsp;&nbsp;  
> > Another view on this:
> 
> I just rewrote a lot of data processing scripts in Ruby. The  
> prior version was a mix of perl with a few speed-critical  
> functions implemented as standalone C programs. I \_do\_  
> care about speed with these -- a full analysis run on the  
> data we've got right now takes about a day and a half -- but  
> I also cared a lot about getting the programs done in time  
> for a conference deadline. The data is about 32 gigs gzipped.
> 
> The new version is about the same speed as the prior version, or  
> just a bit slower, because it's done right, and it was easier to  
> do right -- but doing line processing with Ruby 1.8 (which doesn't  
> have the new oniguruma regexp library) is noticably slower than  
> doing the same thing in perl if you're doing a lot of
> 
> if (l =~ /pattern/) ...
> 
> Doing it right resulted in the memory footprint dropping from  
> about 500MB to 7MB, which was pleasant, and avoiding some  
> stupidity in the perl code (which was pretty entrenched)  
> sped things up enough to compensate for the slowdowns. I'm \_very\_ glad I took the time to rewrite it. I had to  
> do a few workarounds to avoid particular slowdowns in Ruby (see my earlier thread about zlib slowness, in particular),  
> but it wasn't onerous.
> 
> But if you ignore programmer effort and the possibility  
> of better program structure, comparing the raw speed of  
> a JITted Java to Ruby is probably going to come down on the  
> side of Java. Of course, if you can easily implement your  
> "inner loop" functionality in C, you could always quickly  
> swig it and 'require' it from within ruby. 🙂
> 
> Interested to hear what you think after the project.
> 
> -Dave

War stories. I wonder if theres already a page for it on RubyGarden, if not it should be created. I'd love to hear about people who converted program(s) from \<that language\> to Ruby. It would be interesting and benificial to the community. Also it would encourage more to convert as well.

David Ross

> **···**
>
> --  
> Hazzle free packages for Ruby?  
> RPA is available from [http://www.rubyarchive.org/](http://www.rubyarchive.org/)

---

<div class="post-metadata">

**Author:** ![James\_Edward\_Gray\_II](https://avatars.discourse-cdn.com/v4/letter/j/ea5d25/32.png) [@James\_Edward\_Gray\_II](https://rubytalk.org/u/James_Edward_Gray_II)\
**Post date:** [26 October 2004 03:11 UTC](https://rubytalk.org/t/server-programming/14380/17 "2004-10-26T03:11:25Z")

</div>

Then my suggestion is to play with Ruby a bit, if you can afford the time. I program in Java because I have to, and Ruby because I love to. Hopefully you'll feel the same.

Good luck with your project.

James Edward Gray II

> **···**
>
> On Oct 25, 2004, at 10:03 PM, Andy Stone wrote:
> 
> > I know there's no "holy grail" for computer languages, but I'm always  
> > looking. 🙂

---

<div class="post-metadata">

**Author:** ![Robert](https://avatars.discourse-cdn.com/v4/letter/r/e95f7d/32.png) [@Robert](https://rubytalk.org/u/Robert)\
**Post date:** [26 October 2004 11:39 UTC](https://rubytalk.org/t/server-programming/14380/18 "2004-10-26T11:39:04Z")

</div>

"Andy Stone" \<xsltguru@gmail.com\> schrieb im Newsbeitrag  
news:569c94e504102520022fb91850@mail.gmail.com...

> I agree. In relation to a process, the overall speed can be affected  
> by many factors including code design, database design and... I could  
> go on, but I'm sure you already know all of this.
> 
> If there was a choice, I would trade some speed for reliability any  
> day. What good is a super fast process if it crashes from time to  
> time?
> 
> I heard that comment a lot about writing code faster with Ruby. Which  
> is one of the main reasons I am evaluating Ruby. As the sole  
> developer at the day job, maintaining two entirely different and in  
> some areas, complex web sites along with the intranet, this aspect of  
> Ruby could help me out tremendously.

OTOH you have to write the code from scratch, i.e. you have increased  
effort upfront. That may or may not be acceptable in your case. From  
what I've read in this thread I'd have a slight tendency to stick with the  
Java version, get me a copy of Eclipse (if you don't have it already) and  
start a refactoring frenzy to get the code into better shape. It might  
well be that the occasional hang is due to some threading problem which  
came into existence through improper use of synchronization. \*If\* you go  
down that road "Concurrent Programming in Java" (Doug Lea) is an excellent  
reference. (It's also good as a general introduction of MT issues  
though.)

Kind regards

&nbsp;&nbsp;&nbsp;&nbsp;robert

---

<div class="post-metadata">

**Author:** ![Bill\_Guindon1](https://avatars.discourse-cdn.com/v4/letter/b/4da419/32.png) [@Bill\_Guindon1](https://rubytalk.org/u/Bill_Guindon1)\
**Post date:** [27 October 2004 02:54 UTC](https://rubytalk.org/t/server-programming/14380/19 "2004-10-27T02:54:55Z")

</div>

Good idea, and it works the other way around also. atm, I'm taking  
what I've learned from Ruby and bringing some of it to the world of  
Miva. I've played with this idea for a couple of years, and it's  
finally live, thanks to Ruby.

The months that I spent learning Ruby are paying off in ways I never  
would have imagined, and without a doubt, it was well worth the time.  
Ruby gave me a new perspective on some old code, and it gave me some  
new tools to generate code for the truly tedious parts of what I'm  
doing.

In a nutshell, learning Ruby has put the "possible" in "impossible" (a  
reverse of the old joke "they put the "fun" in "dysfunctional").

> **···**
>
> On Wed, 27 Oct 2004 10:36:08 +0900, David Ross \<dross@code-exec.net\> wrote:
> 
> > War stories. I wonder if theres already a page for it on RubyGarden, if  
> > not it should be created. I'd love to hear about people who converted  
> > program(s) from \<that language\> to Ruby. It would be interesting and  
> > benificial to the community. Also it would encourage more to convert as  
> > well.
> 
> --  
> Bill Guindon (aka aGorilla)

---

<div class="post-metadata">

**Author:** ![Andy\_Stone](https://avatars.discourse-cdn.com/v4/letter/a/94ad74/32.png) [@Andy\_Stone](https://rubytalk.org/u/Andy_Stone)\
**Post date:** [27 October 2004 04:00 UTC](https://rubytalk.org/t/server-programming/14380/20 "2004-10-27T04:00:47Z")

</div>

It's good to hear the war stories. It seems I have a good one brewing.

My task is complicated by the fact that there is a good amount of  
shared code between this client/server app and the web application  
itself. This code is in the form of data objects responsible for  
reading/writing to the database as well as representing the entities  
of the project.

What I have found interesting about this whole process was stepping  
back and reviewing the code architecture after a year of requirement  
changes. Even though great consideration was taken in object design  
it appears that the greatest flaw was in packaging. Don't get me  
wrong, the client/server app definitely needs work (hence the reason  
this started), but the project as a whole should have been taken into  
account when the system was being designed. It seemed that the focus  
was always so granular the big picture was never brought into view.  
Of course, this has been an ugly, ugly (and one more time for  
emphasis), ugly project from the beginning. I'm actually quite amazed  
it's been working for so long.

So, now I have a system that requires this repackaging regardless of  
going with Ruby or not. Over the next couple of days I will be doing  
just that. Once I have tested the repackaging, I can then resume the  
issue of what to do with this client/server app.

Any recommendations on a JAVA/Ruby interface? Is that a viable  
option? There are other ways I can handle what I need to maintain  
between the java web app and a ruby client/server app, I was just  
curious if someone has come up with a real slick solution.

-andy

> **···**
>
> On Wed, 27 Oct 2004 11:54:55 +0900, Bill Guindon \<agorilla@gmail.com\> wrote:
> 
> > On Wed, 27 Oct 2004 10:36:08 +0900, David Ross \<dross@code-exec.net\> wrote:
> > 
> > \> War stories. I wonder if theres already a page for it on RubyGarden, if  
> > \> not it should be created. I'd love to hear about people who converted  
> > \> program(s) from \<that language\> to Ruby. It would be interesting and  
> > \> benificial to the community. Also it would encourage more to convert as  
> > \> well.
> > 
> > Good idea, and it works the other way around also. atm, I'm taking  
> > what I've learned from Ruby and bringing some of it to the world of  
> > Miva. I've played with this idea for a couple of years, and it's  
> > finally live, thanks to Ruby.
> > 
> > The months that I spent learning Ruby are paying off in ways I never  
> > would have imagined, and without a doubt, it was well worth the time.  
> > Ruby gave me a new perspective on some old code, and it gave me some  
> > new tools to generate code for the truly tedious parts of what I'm  
> > doing.
> > 
> > In a nutshell, learning Ruby has put the "possible" in "impossible" (a  
> > reverse of the old joke "they put the "fun" in "dysfunctional").
> > 
> > --  
> > Bill Guindon (aka aGorilla)
