Monday, March 16, 2009

running X applications from linux


this is just a quick way to run linux applications on an X session from another linux/opensolaris client. i mean you want to run an x application - such as gimp, rhytmbox etc.- on linux box inside an X session in an X environment, which looks like this.

so todo that i first ssh -X to linux box,


ssh -X mediapc


then i run Xephyr - or you can run Xnest, but xephyr is a little bit faster -, then run an xterm with blackbox.

Xephyr -screen 1150x750 :2 &
xterm -display :2 -e blackbox &



or you can put them in a shell script like this

aybars@ubuntu:~$ cat ./xepstart
#!/bin/bash
Xephyr -screen 1150x750 :2 &
sleep 2
xterm -display :2 -e blackbox &


you need to wait/sleep for a couple of seconds for X to initialize. or if you like gnome, you can say


aybars@ubuntu:~$ cat ./xepstart
#!/bin/bash
Xephyr -screen 1150x750 :2 &
sleep 2
xterm -display :2 -e gnome-session &


to install xephyr on ubuntu

sudo apt-get install xserver-xephyr

running nx client from linux

i don't know if you ever used nomachine-nx to access your linux machines, its much better in performance compared to vnc.

there is a client for solaris/sparc, but as you may guess, it doesn't work on intel/amd platform.

anyway there are efforts on making an opensolaris nxclient for intel platform, you can try to compile it

http://blogs.sun.com/xavier/entry/freenx_opensolaris

or you can try to install a precompiled one for solaris:

http://www.kraftek.com/blog/index.php?/archives/227-NX+freenx-server-binary-tarball-for-Solaris-10-x86.html

or there is one without dependencies only for opensolaris
http://www.opensolaris.org/os/project/awards/awards_land/Entries/ (the second one,Port NX+freenx to Solaris x86), i don't remember if this one had client in tar.gz.

or you can try this one

http://opensolaris.org/jive/thread.jspa?threadID=83962, there is a link to

anyway, i was unlucky i couldn't get neither them working, - i didn't spend too much time to be honest -, so as a workaround, i make


aybars@opensolaris:~$ ssh -X 192.168.1.64
aybars@ubuntu:~$ /usr/NX/bin/nxclient &


it works as expected.

mount linux nfs shae from open solaris

although i am not quite sure why but mounting an nfs share from open solaris needs version parameter, something like this.


sudo mount -F nfs -o vers=3 mediapc:/home/aybars /media/mediapc/



if you say

aybars@opensolaris:~$ sudo mount -F nfs -o vers=4 192.168.1.64:/home/aybars /media/mediapc/
nfs mount: 192.168.1.64:/home/aybars: No such file or directory


if you want to know more on this subject,
http://blogs.sun.com/macrbg/entry/solaris_nfsv4_client_mount_from

Thursday, March 12, 2009

about this blog

well i am web application developer for the last 10 years, and a programmer for 15 years. i used php, ruby, c#, delphi, pascal, javascript, actionscript in many projects.

about 2 weeks ago, i thought i had to reformat my harddrive, because, ubuntu was getting slower and slower everyday - i installed it about a year ago. and i mention this, getting slow is not because of ubuntu, i maybe am really the worst kind of user for an operating system.

i install everypackage, compile everything re-install them, mess up with config files, then remove, then install... at last, at some point everything gets messy.

so i'll try to make myself clear, ubuntu is a really good distro that i really enjoyed using.

anyway, i was thinking about installing ubuntu again, because i was happy with it, but i thought i may try opensolaris for a couple of days and then format the whole drive.

well, to be honest opensolaris rocks, really. as a developer, using my laptop for more then 12 hours a day, i cant even express my feelings about opensolaris. i really really loved it.

zones are great, dtrace is revolutionary, its stable. its fast. and i believe this is just the top of the iceberg.

so this is a whole new adventure for me, and i thought i may fire up a blog and share my experience with it.


anyway, i used many operating systems, including win95, nt40, irix - but i dont say im a sysadmin - i am a programmer, its just not my job. so please dont forget this posts are from a newcomers point of view.

rails on opensolaris vs. rails on linux benchmarks

open solaris rocks (really), i'm using it as a developer on desktop and its great. i wanted to see how its performance is compared agains linux. so here we go...

i made a simple web site with rails, it just serves a web page and sends a query to mysql and shows it - just a simple web application-. i ran all benchmarks from a local networked ubuntu, so benchmarking should not be effecting performance. i ran each benchmark 3 times - to warm it up - and then ran again 3 times, these numbers are last three runs.

i used ruby, mysql from ips stack. i did same tests with thin and mongrel.

first i ran test with 1 process, and then i used nginx to reverse proxy to 4 processes. then i rebooted the machine, and started over in ubuntu 8.10. ruby/mysql/nginx was installed by synaptics - ruby version differs btw, ubuntu comes with ruby 1.8.7 installed and opens solaris (2008.11) comes with ruby 1.8.6.

so as long as the machine is identical - its the same laptop - these numbers may give you a clue.

i am using zones in solaris, first i ran only one thin process, and benchmarked with ab.

ab -n 1000 -c 100 http://192.168.1.209:9690/chat/
single process - thin
Requests per second: 172.14 [#/sec] (mean)
Requests per second: 187.11 [#/sec] (mean)
Requests per second: 178.25 [#/sec] (mean)

and then i thought if i do this in global zone what will change...

Requests per second: 188.44 [#/sec] (mean)
Requests per second: 188.57 [#/sec] (mean)
Requests per second: 173.15 [#/sec] (mean)


there was not much difference, so zones are really lightweight. so i didnt repeat the tests in global zone.

anyway, 4 thin process, upstreamed from nginx


Requests per second: 229.80 [#/sec] (mean)
Requests per second: 249.45 [#/sec] (mean)
Requests per second: 267.92 [#/sec] (mean)


now i wanted to see how mongrel is compared to thin on solaris.

mongrel 1 process

Requests per second: 126.04 [#/sec] (mean)
Requests per second: 121.87 [#/sec] (mean)
Requests per second: 119.53 [#/sec] (mean)


and mongrel 4 process on opensolaris

Requests per second: 182.07 [#/sec] (mean)
Requests per second: 177.18 [#/sec] (mean)
Requests per second: 176.31 [#/sec] (mean)


then i rebooted the machine into ubuntu and started again

thin 1 process

Requests per second: 253.94 [#/sec] (mean)
Requests per second: 242.28 [#/sec] (mean)
Requests per second: 246.67 [#/sec] (mean)

thin 4 process upstreamed by nginx on linux

Requests per second: 336.30 [#/sec] (mean)
Requests per second: 326.03 [#/sec] (mean)
Requests per second: 320.67 [#/sec] (mean)

mongrel 1 process

Requests per second: 196.33 [#/sec] (mean)
Requests per second: 196.13 [#/sec] (mean)
Requests per second: 198.44 [#/sec] (mean)

mongrel 4 process upstreamed by nginx

Requests per second: 238.31 [#/sec] (mean)
Requests per second: 244.72 [#/sec] (mean)
Requests per second: 233.49 [#/sec] (mean)


so here are the graphs


thin 1 process linux vs. open solaris



thin 4 process linux vs. open solaris


mongrel 1 process


mongrel 4 process



here is the configuration in two operating system
ubuntu linux (8.10)
uname -a :
Linux aybars-laptop 2.6.27-11-generic #1 SMP Thu Jan 29 19:28:32 UTC 2009 x86_64 GNU/Linux
ruby :
ruby 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux]
mysql :
mysql Ver 14.12 Distrib 5.0.67, for debian-linux-gnu (x86_64) using readline 5.2
gems :
thin (1.0.0)
eventmachine (0.12.6)
ventmachine (0.12.6, 0.12.2)
mongrel (1.1.5)
Rails 2.1.1

open solaris (2008.11)
uname -a :
SunOS opensolaris 5.11 snv_101b i86pc i386 i86pc Solaris
mysql:
mysql Ver 14.12 Distrib 5.0.67, for pc-solaris2.11 (i386) using readline 5.1
ruby:
ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-solaris2.11]
gems:
thin (1.0.0)
mongrel (1.1.5)
eventmachine (0.12.6)
mongrel (1.1.5)
rails (2.1.1)

in conclusion, i have several opinions about this results
1. zones are really lightweight and great
2. two operating systems are installed from stack - no optimization, no hand compiling etc.. so if you install just inserting a cd and boot then ubuntu beats hard. maybe its just because of ruby version or something with flags used to compile ruby, but i guess an operating system is not just the kernel, the components must be optimized and as new as possible.
3. i really am curious why the hell my kernel reports as i386 on solaris, shouldn't it be x86_64 or similar. it didn't ask me about anything, and there is only one iso.

anyway stack version of both systems, ubuntu default installation beats hard open solaris, so i think i will stick to my ubuntus on our servers.

and btw, please take this benchmarks just, as out of the box experience, none of them are optimized.