Single Node Persistence
I was reading an F5 configuration and saw the iRule in this codeshare link.
I knew it would have had to come from DevCentral. :D
The solution proposed here works fine.
However, as indicated in previous comments, destination address does the same job.
I just want to add more information about the performance side.
I hope this will make clear that destination address persistence is a better option.
As a general rule, only use an iRule if there is no builtin functionality for what you want to do.
Destination address persistence is a builtin functionality, universal persistence is also builtin but triggers an iRule.
I don't have access to F5 source code, so I will assume how the persistence table lookups work.
The iRule is using "1" as the key, so if you use the same persistence profile in multiple virtual servers, you will end up with multiple persistence with the key "1".
The persistence table does show the virtual server IP, so it lists the following.
universal (persistence type) - 1 (key) - virtual server IP and port - pool member ip and port - TMM number
I assume the system first do a lookup for key "1", and from that list, do another lookup for the virtual server IP and port.
As someone said in the comments, using something unique to the virtual server, like virtual IP and port, should remove the need for the second lookup.
All that to say, it is better to use destination address persistence than the solution proposed in this code share.