It would be better to post code than link to an external reference. I tried to reply to XWS's post but its hard to add formatted code there, hence my own post.
So to use JSession to set a variable:
$foo = 'bar';
$session = JFactory::getSession();
$session->set('path.to.my.variable', $foo);
// Retrieve the stored value (could be a different file on a different page request)
$foo = $session->get('path.to.my.variable');
echo $foo; // outputs 'bar'
Note that by using a dotted name path, you are actually creating a nested array in PHP's global $_SESSION. This comes in handy when you want to set an array as a session variable:
$foo = array('foo' => 'bar', 'foofoo' => array('me' => 'you'));
$session = JFactory::getSession();
$session->set('path.to.my.variable', $foo);
echo $session->get('path.to.my.variable.foo'); // outputs 'bar'
echo $session->get('path.to.my.variable.foofoo.me'); // outputs 'you'
The above examples uses the default session namespace, you can alternatively use your own namespace, in the example below I'm using 'myNameSpace' as the namespace name:
$foo = 'bar';
$session = JFactory::getSession();
$session->set('path.to.my.variable', $foo, 'myNameSpace');
// Retrieve
$foo = $session->get('path.to.my.variable', 'default', 'myNameSpace');
echo $foo; // outputs 'bar'
Finally moomoochoo suggested using memcache as an altenative. I've not seen any issues with JSession, but be aware that the JSession class wraps several different storage options, the default is to store to the mySQL database, but you also have apc, memcache, wincache, and xcache drivers available. So if you did have something like memcache installed this could be selected as a JSession storage option in Joomla's global config page, system tab 'session handler' dropdown option.