As I’ve ported ClockingIT to use Sphinx/Ultrasphinx instead of ferret/acts_as_ferret, I figured I’d give jruby a shot to see how it compared to MRI when running ClockingIT. I’ve wanted to do this for a long time, but the reliance on ferret/acts_as_ferret for search has made it impossible to do until now, as native C extensions don’t work with jruby.

The test machine is an Intel Core2 Quad @ 2.4Ghz with 8GB memory and SATA2 Raid5 disks running ArchLinux x86_64 and a 2.6.27 linux kernel. The benchmark consists of 23 different web pages from ClockingIT, requested 100 times each, using real data from my own hosted instance.

MRI 1.8.7 p72 / mysql / mongrel

Initial run: 6m46.396s
 Second run: 6m43.450s

jruby 1.1.5 –server / jdbcmysql / mongrel

Initial run: 6m8.400s
 Second run: 5m20.322s

jruby 1.1.6RC1 –server / jdbcmysql / mongrel

Initial run: 5m50.992s
 Second run: 4m59.823s

MRI 1.8.7 p72 / postgresql / mongrel

Initial run: 7m21.408s
 Second run: 7m17.608s

jruby 1.1.5 –server / jdbcpostgresql / mongrel

Initial run: 6m37.021s
 Second run: 5m55.811s

The PostgreSQL is mostly just there for comparison, and is not nearly as tweaked or optimized as the MySQL version, but it contains the same data.

WYSIWYG Wiki Editor

July 27, 2008

I’ve integrated TinyMCE when editing Wiki pages and Notes. This means that you don’t have to muck about with Textile/Markdown to add formatting to your pages, as a lot of people have problems understanding how that works and getting the formatting right.

I’ve also added support for wrapping code and such in <pre></pre> which turns off all WikiWords, autolinkification and task linking.

I’ve been struggling a bit with a case of

marshal data too short

for one of my users. It happened out of the blue, and I was stumped as to how it could happen, as I only save a couple of ID’s in the sessions and never any objects.

Turns out I forgot something which is pretty obvious, really.

flash['notice'] = "#{link_to_task_with_tooltip} successfully saved"

As the tooltip contains the full task description, what would happen if someone entered a massive description (~65kb) and saved the task?

It would case the session data to get truncated on save, and end up impossible to restore on the next request.

Also, the exception when this happens doesn’t really include any useful information (like which session it was unable to restore) so I thought this was a way more common problem than it really was. Turns out this problem only affected two users, but they both kept trying and trying and it looked like I had this problem all over the place.

Fix coming up. 🙂

There’s been some changes to the GANTT view, and you can now drag a task-bar or milestone indicator to change the due dates.

All changes done to the chart are kept temporary, until you either save the new schedule or revert back to the last saved state. Saving the schedule creates Acitivity Log entries, and send out email notifications if you want and have those enabled.

Editing a task outside of the GANTT view will reset the temporary data to the new values, if they change.

GANTT dependencies

June 29, 2008

I’ve had a go at making the ajax GANTT chart respect dependencies, which turned out to be quite tricky as this is happening on a webpage, and I can’t really spend much processor-time laying it all out.

It seems to work just fine on my test-cases, but I’m sure I haven’t thought of everything. 🙂

Work Log logging

June 24, 2008

I’ve added a small auto-saving text box to the right menu, which pops up whenever you’re working on something. Whatever you enter in there will be logged to your current work log, so it’s even easier to remember what you’ve done.

Translations…

June 23, 2008

When I added translations to ClockingIT I went with a really simple system where all the strings to be translated are defined along with their translations in a file, with one file per language. This worked great for initially translating the whole thing to a new language, but it’s broken down as I’ve added more and more languages, changed strings, and added new strings.

To get some new text translated these days, I’ve had to add the strings to 13 different files, and contact 13 different people to do update the translations, some of which don’t have Git and need to have the complete file emailed back and forth.

No more! New strings are now automatically added to a table in the database, and I’ve added a simple form to update the translation of your language. I’ve also added a couple of rake tasks to dump/restore this information to/from the normal language files so you have a backup in case someone makes a mistake.

I’ve been running ClockingIT for quite a while now, and at some point something was introduced which made the memory usage grow and grow over time. I installed God to monitor and restart my Mongrels whenever they grew too big, but I can’t say I’ve been very comfortable with that solution.

Then, when I bought a new server to run on, I figured I’d get a bit more RAM and go 64bit to be able to use it. And found out that Ruby uses ~ 2x the memory, due to addresses in every object taking double the space.

I took some time to look for a better solution, and found something which works really great for me.

Enter Thin, Slim Attributes, Erubis and a Ruby GC patch:

Setup                        Time   VIRT    RES
-----------------------------------------------
MRI/Mongrel             0m37.607s 181660 120720
MRI/Mongrel/Erubis      0m37.536s 181660 120920
MRI/Mongrel/Slim        0m36.399s 181672 119300
MRI/Mongrel/Erubis/Slim 0m36.020s 182696 120064

GC/Mongrel              0m37.416s 177560 119268
GC/Mongrel/Erubis       0m37.260s 172440 114484
GC/Mongrel/Slim         0m35.024s 164260 105656
GC/Mongrel/Erubis/Slim  0m35.049s 163236 104656

MRI/Thin                0m36.828s 172624 111512
MRI/Thin/Erubis         0m36.878s 175696 114724
MRI/Thin/Slim           0m35.457s 175708 113532
MRI/Thin/Erubis/Slim    0m35.087s 176732 114700

GC/Thin                 0m36.208s 166476 108888
GC/Thin/Erubis          0m36.121s 166476 108724
GC/Thin/Slim            0m33.854s 155224  97060
GC/Thin/Erubis/Slim     0m33.832s 155224  97080

Keep in mind that this is on a 64bit platform, so a 32bit version would use ~ half the memory.

I’m getting a lot fewer restarts of my webservers with this setup, which can only be a good thing. It’s also been rock solid after ironing out a couple of problems with Slim Attributes.

Gantt galore!

June 17, 2008

I’ve had a bit of fun lately, adding a way to easily see your schedule and make changes. It’s not a strict gantt chart like MS Project uses, but rather an automatic one which shows remaining work as time passes and work is logged.

Whenever an estimate or due date is changed, the chart is automatically updated and re-scheduled to try and accomodate your wanted schedule.

If multiple people are assigned to the same task, it’ll be scheduled for when everyone has time free. This will probably be possible to specify with an option later on.

I’m also not sure if filtering the list makes a lot of sense, as you’d end up with either a bogus schedule (consider only the shown tasks) or strange gaps in the schedule (occupied by hidden tasks).

Hope you find it as usefull as I do. 🙂

New instant messaging

June 2, 2008

As I’m at home with my young daughter these days on paternity leave, I needed something to do while she had her naps in the mornings. I really liked the idea of a Facebook-ish messaging system, which someone suggested on the forums, and started last Tuesday.

On Saturday, it was ready for launch, and is now live. 🙂

Total implementation time, 9.5 hours including styling and fiddling with IE6.

Overview