fastos / fastsocket

Fastsocket is a highly scalable socket and its underlying networking implementation of Linux kernel. With the straight linear scalability, Fastsocket can provide extremely good performance in multicore machines. In addition, it is very easy to use and maintain. As a result, it has been deployed in the production environment of SINA.
GNU General Public License v2.0
3.76k stars 730 forks source link

rfd的代码为什么注释掉了? #17

Closed jlijian3 closed 9 years ago

jlijian3 commented 9 years ago

rfd的代码为什么注释掉了?这样proxy 的回包如何保证分派到同一个cpu?

objectkuan commented 9 years ago

可以关注一下Receive-CPU-Select部分的代码

jlijian3 commented 9 years ago

看了一下process_rcs_rps,__inet_lookup?established表还是全局的? source port encode cpuid的方法不打算用了吗?

objectkuan commented 9 years ago

对的,在process_rcs_rps。 在加载了Fastsocket的内核工作的过程中,连接对应的sock会记录着进程所在的cpu编号,于是回包查找sock的时候就可以知道分派到哪个cpu上了。 查找sock的过程是通过__inet_lookup实现的,还是和其他地方一样查established表和listen表,得到sock之后才会分配到一个cpu上 考虑到这种实现比source port encode cpuid的方法通用性会更好,比如cpu数多了之后策略上不用考虑端口资源紧张的问题等,希望以后能取代rfd