Increase TCP max connections on Mac OS X

Reason I was trying to benchmark a TCP based file server on Mac OS X. The server is running latest Node.js (0.8.2), while the client to push the server is written in go. ‘Go’ can start thousands of concurrent goroutines easily. I got error when there are hundreds of concurrent clients. Steps increate max open files kern.maxfiles and kern.maxfilesperproc were small numbers, they need to be increased: after this, you can increase your account’s limit by ulimit -n:
Read more →

VMware Fusion 3 Network Configuration

In this post, I summarized how to config VMware Fusion 2’s network. For the new VMware Fusion 3, it’s much easier. VMware Fusion 3 has a separate configuration file for networking only. The file is: /Library/Application Support/VMware Fusion/networking A sample file as following: VERSION=1,0 answer VNET_1_DHCP no answer VNET_1_HOSTONLY_NETMASK 255.255.255.0 answer VNET_1_HOSTONLY_SUBNET 172.16.125.0 answer VNET_1_VIRTUAL_ADAPTER no answer VNET_1_VIRTUAL_ADAPTER_ADDR 172.16.125.1 answer VNET_8_DHCP no answer VNET_8_DHCP_CFG_HASH E7EBB6E40048285A05D25835904AFD8BEC1CD2B2 answer VNET_8_HOSTONLY_NETMASK 255.255.255.0 answer VNET_8_HOSTONLY_SUBNET 192.
Read more →

The Powerful lsof

lsof can list all open files in osx. As directories, sockets are all also files in unix. lsof can also be used to find open ports/sockets/directories: To list all open TCP sockets with port numbers: sudo lsof -i -P To find processes open a folder or any file in that folder sudo lsof +D /the/foler To find process open any file on a dev sudo lsof /dev/disk0s2 To print all found process id only sudo lsof -t <other commands> Details can be looked up in the man page.
Read more →

Boot Snow Leopard in 64bit Mode

Currently, SL does not boot in 64 bit mode by default. You can check it by running “uname -a” in terminal. To boot it in 64 bit, press 6 and 4 while booting or set the nvram: $ sudo nvram boot-args=“arch=x86_64” In 64bit mode, the kernel will run with architecture of x86_64. So it loads only x86_64 kexts. Which means CiscoVPN and VMware Fusion’s kexts won’t load. If you need CiscoVPN and VMware Fusion like me, you need to switch back to 32bit kernel by this command:
Read more →

VMware Fusion Network Configuration

VMware Fusion does not include a network configuration tool like in Windows. But it does not mean you cannot config it. When the system starts, it will load the plist file of /Library/LaunchDaemons/com.vmware.launchd.vmware.plist, which will call the script boot.sh under /Library/Application Support/VMware Fusion/ <dict> <key>Label</key> <string>com.vmware.launchd.vmware</string> <key>ProgramArguments</key> <array> <string>/Library/Application Support/VMware Fusion/boot.sh</string> <string>–start</string> </array> <key>RunAtLoad</key> <true/> </dict> So, let’s look into the boot.sh. boot.sh supports 3 commands: –start, –stop and –restart.
Read more →