There is no "best ramp-up time", there is only a recommendation to increase the load gradually so you would be able to correlate increasing load with other metrics like response time, throughput, number of errors, etc.
If you need a quote with it comes to suggested ramp-up period you can stick to official JMeter documentation which states:
The ramp-up period tells JMeter how long to take to "ramp-up" to the full number of threads chosen. If 10 threads are used, and the ramp-up period is 100 seconds, then JMeter will take 100 seconds to get all 10 threads up and running. Each thread will start 10 (100/10) seconds after the previous thread was begun. If there are 30 threads and a ramp-up period of 120 seconds, then each successive thread will be delayed by 4 seconds.
Ramp-up needs to be long enough to avoid too large a work-load at the start of a test, and short enough that the last threads start running before the first ones finish (unless one wants that to happen).
Start with Ramp-up = number of threads and adjust up or down as needed.
"Socket exception" is too broad term, there could be multiple reasons behind it and therefore multiple solutions. If it doesn't happen for 1-2 users and happens for 20 - most probably your application gets overloaded somehow and cannot process that many requests. You can take a look at jmeter.log file
and/or add the next line to system.properties file:
javax.net.debug=all
and next time you run your test you will see a lot of debugging information in the STDOUT
More information: