having been on a few boardings in my day, I think the optimum is a mix of .45s and shotguns with buckshot. MSC used to teach counter boarding tactics with Ithaca and Remington pump guns.
Small craft (yachts, etc) are made with fiberglass and wood penetration with just about anything is a given. Ships are made of steel and sometimes aluminum, ricochets and not penetration are the order of the day.
Challenge #1 is getting on, #2 is getting in the skin of the ship.
The MSC chartered freighters that shuttled between Guam, Philippines, Singapore, Diego Garcia used to have gratings that were locked down over the outboard ladders to prevent getting off the main deck and the water tight doors were locked from the inside. Anybody that successfully was able to catch up, come alongside and some how get up a ladder or rope couldn't get in or get to anybody.
Other ships used similar methods. Boarding a ship that uses more active countermeasures will really get tough. Boarding a cooperative ship underway in anything more than a dead calm is damn dangerous. Boarding one that doesn't want you to come aboard is close to impossible without using force to make them cooperative.