Trond Norbye's Weblog

Monday Mar 17, 2008

Bazaar support in OpenGrok

I have just added support for Bazaar repositories in OpenGrok, and thought that I should give you a warning before you start to use it...

First of all I would like to say that I have never used Bazaar in a real project, so I might have done everything totally wrong.

I am not aware of a API that lets me access Bazaar from Java, so I just created a small class that wraps the command line interface. This is the same way the Mercurial support is implemented, and most of the projects available at http://src.opensolaris.org/source use that back-end. Wrapping the binary do have a runtime-penalty, and that is the startup-cost of the binary. To reduce the number of times the binary is executed, OpenGrok already have a cache-layer for the history log (the cache-layer is not used if you try to get history information for a directory).

The biggest problem with Bazaar is that the bzr log -v command is unbelievable slow, and that is the command I need to run to get the history information (I need the files in the changeset). When I tried it on my computer, it used 13 MINUTES on the Bazaar source code itself. I got the repository with the following command:

$ bzr branch http://bazaar-vcs.org/bzr/bzr.dev bzr.dev

As a comparison hg log -v used ~ 2 secs on:

$ hg clone ssh://anon@hg.opensolaris.org/hg/onnv/onnv-gate

I would therefore not recommend that you use the Bazaar support on an OpenGrok server that serves multiple users. If you use it yourself, you should avoid accessing the directory history if you don't need it ;-)

Wednesday Mar 12, 2008

OpenGrok v0.6 is out

I am glad to announce the release of OpenGrok 0.6. This release contains a lot of bug-fixes and some new features. Please see http://src.opensolaris.org/source/history/opengrok/trunk/ for the full change history, and for the list of contributors. The following is just a summary.

New Features:

  • Analyzer-support for Tcl/Tk
  • Analyzer-support for SQL
  • Support for TeamWare repositories

Monday Mar 03, 2008

Get it while it's hot!

Memcached 1.2.5 is being released today, so you should go ahead and download it. We are currently working on integrating this version into Solaris, but it is easy to compile it yourself if you don't want to wait for us ;-)

If you are running OpenSolaris build 79 (or newer), building 1.2.5 should be as easy as:

./configure --enable-threads --enable-64bit CC=cc CFLAGS=-O

I have added support for large memory pages in this version, but it is disabled by default. To enable the use of large memory pages you need to add -L to the command line. When started with -L memcached will also preallocate all memory up front and reduce the numbers of lock to acquire when the slab allocator needs to allocate more memory for a given slab class. By using large memory pages memcached could reduce the number of TLB misses (depending on the access pattern), and hence improve performance. See http://en.wikipedia.org/wiki/Translation_lookaside_buffer for a description of TLB.

Saturday Feb 09, 2008

Improve the performance on your Memcached server

I recently came across this interesting blog about tweaking the TCP stack in Solaris for improved latency, and with a small test I noticed a significant latency improvement. Since low latency is important for memcached servers, you might want to try it yourself?

Tuesday Jan 29, 2008

Heat pump

This weekend I got help from my friend to install a heat pump in my house, and so far it has been a huge success! We got a relatively large room in the basement (~50m^2) where I got my home office, my guitars and the TV. I have just finished renovating this room (replaced the carpet floor with tiles and painted the walls), but it is usually very cold down there since no one remembers to light the fireplace before we want to watch TV.

With the heat pump mounted in the basement, it's been a pure pleasure coming home from work and go down in the basement to watch TV.

Monday Jan 28, 2008

SunRay @ home

The fans and the disks in my desktop computer is driving my girlfriend crazy, so I decided to go ahead and try to configure my good old SunRay 1G I got. My desktop machine is an old 3GHz Intel P4 with 1,3GB of RAM with two 300GB disks spinning all the time (they are used in an ZFS mirror), so it sounds like an airplane just before takeoff... My desktop is located in the basement and is connected to a wireless router upstairs with a D-Link DWL-G520. I also have a wired network adapter in the machine connected to a switch, so I just connected the SunRay to the switch and ran the software installer. After running utconfig and utadm I got the login screen up on the SunRay!!! Now I just need to find a room in the basement where I can put my server :-)

Friday Jan 25, 2008

Memcached source repository

I am currently working in a team here at Sun that focus on improving Memcached performance.

The official Memcached source repository is a Subversion repository located at http://code.sixapart.com/svn/memcached/. Since Subversion is not well suited for distributed development, we need a place to store our changes while waiting for them to be accepted into the official repository.

I asked the community how we should do it, and they responded that we should set up an a repository to incubate our changes. I have created a Mercurial repository in the Web Stack project. It contains two Mercurial branches:

You may clone the repository with the following command:

$ hg clone ssh://anon@hg.opensolaris.org/hg/webstack/memcached-incubator

To select the branch you would like to see, execute the following command:

$ hg update branch

To see the difference between the two branches, just select the default branch and execute:

$ hg diff -r memcached

Please note that bugs should be reported to "memcached at lists dot danga dot org" unless it only applies to our branch. In that case you can send them to "webstack-discuss at opensolaris dot org"

Thursday Jan 24, 2008

OpenGrok and SMF

I have had SMF controlling my OpenGrok server for a long time, but up until today I have always performed the SMF management as root.

When I upgraded my server today I decided to try to figure out what I needed to do in order to create a new profile that I could use to start and stop OpenGrok, and it turned out to be quite easy.

The first thing you need to do is to create the authorizations and the profile by adding them to /etc/security/auth_attr and /etc/security/prof_attr:

/etc/security/auth_attr:
solaris.smf.value.opengrok:::Change OpenGrok value properties::
solaris.smf.manage.opengrok:::Manage OpenGrok service states::

/etc/security/prof_attr:
OpenGrok Administration::::auths=solaris.smf.manage.opengrok,solaris.smf.value.opengrok

The next thing you should do is to add this profile to the users you trust by updating /etc/user_attr

username::::profiles=OpenGrok Administration

(If you don't trust them that much you could give them just one of the authorizations)

You should now be ready to import the OpenGrok SMF description file (tools/smf/opengrok.xml in the OpenGrok source repository) and modify the environment-section to match your local configuration. (Note: you need the one I committed in changeset 228:175ea847bf89)

Import the service by executing the following command:

# svccfg import /path/to/opengrok.xml

Users should now be able to start and stop the service as long as they have the appropriate authorizations.

Tuesday Jan 08, 2008

Memcached in Solaris

I have been working on integrating Memcached into OpenSolaris for a while, and it is now integrated and available if you would like to try it!

The Memcached server is controlled by SMF and needs to be configured before it can be started. You must at least specify the username for the user you would like memcached to run as, and you would probably like to increase the amount of memory the server should use. In the following example I am using the user nobody and 2GB of memory (note: you should not exceed the physical amount of RAM available)

# svccfg
svc:> select memcached
svc:/application/database/memcached> setprop memcached/options=("-u" "nobody" "-m" "2048")
svc:/application/database/memcached> quit
# svcadm refresh memcached
        

You can now start memcached by executing:

# svcadm enable memcached
        

And to monitor the status om memcached, you can just execute:

$ svcs memcached
STATE          STIME    FMRI
online         08:20:03 svc:/application/database/memcached:default
        

To shut down the memcached server, execute:

# svcadm disable memcached     
        

Please see memcached(1m) for more information.

Thursday Jul 12, 2007

One year @ Sun

I have just completed my first year working for Sun, and it's been a very interesting year for me. I am working on HADB (a clustered database), which is quite a change from the email systems I've been working on in the past so I have had a lot to learn. The project is filled with highly skilled people willing to explain the glory details of the internal workings of the database, making the transition a lot easier for me.

I hope the next years will be as interesting and great as this one :-)
 

Friday Apr 06, 2007

Amazing powder-snow

Today I went snowboarding for the first time this year. This have been a really stressful year for me, so I have not found time earlier this winter to go snowboarding. It was snowing constantly the whole day, creating a lot of powder-snow making it a perfect day :-)

Wednesday Apr 04, 2007

Seeking new opportunities

I just found out that a former co-worker (from my time working for Thales Norway), and a good friend of mine, Ketil Johnsen have decided to leave Thales and start to work for ARM creating 2D and 3D embedded graphics solutions.

I wish you the best of luck in your new position.
 

Friday Dec 08, 2006

OpenGrok v0.4 Released

After 9 month of waiting since the last release of OpenGrok one should expect a major update, but that is not the case.

The reason for not releasing it as 0.3.2 is that this version contains the following new features:

  • Java analyzer
  • Experimental Mercurial support
Look in CHANGES.txt or in the Mercurial log to get the full list of problems fixed.

Thursday Dec 07, 2006

OpenGrok source repository

I am glad to announce that the OpenGrok source code is available in a Mercurial repository on the OpenSolaris website. You may grab a copy with the following command:

hg clone ssh://anon@hg.opensolaris.org/hg/opengrok/trunk/