配置了20个虚拟ip来突破6W端口限制,但是客户端不提供配置本地ip的接口,如何实现?
1
mhycy 2015-08-11 11:16:30 +08:00
1000000*1480/1024/1024=1411.437988MB/S 先看看网络有没有可能做到这个带宽再说。
|
3
tabris17 2015-08-11 11:29:15 +08:00 1
|
4
yxaaa123 OP @tabris17 “两个配置为6G左右的centos测试端机器(绑定7个桥接或NAT连接)各自发出640007 = 448000。也就是 1024000 = (64000) + (64000) + (640007) + (64000*7), 共使用了16个网卡(物理网卡+虚拟网卡)。 ”关键这句话,不知道这么实现的。。。
假如: 物理ip 192.168.10.200 虚拟ip:192.168.10.201 192.168.10.202 ....... 192.168.10.220 程序内 socket.connect(****),如果不配置本地ip,是没有办法用上虚拟ip的,那么,单个ip最多6W端口,也就只能开6W连接 |
8
yxaaa123 OP |
11
jarlyyn 2015-08-11 12:00:43 +08:00
实在不会搞上虚拟机不就行了……
感觉同时100w客户端不论怎么说一台机器都架不住吧,必然会使用反代之类? ip的话不是会通过代理来获取么? |
12
9hills 2015-08-11 12:28:45 +08:00
@yxaaa123 具体我没试过,不过大抵是这个方法:
1. 用iptables给不同的用户的流量打上不同标记 2. 用iprouter根据不同的标记设定不同的路由表和网卡 大概这样。。然后你创建N个用户,每个用户起6w连接。搜『 iptables route interface』 不过感觉还是修改client来的方便。。 |
13
zhicheng 2015-08-11 13:54:05 +08:00
会玩儿,我都是本机设置成吨的 127/8 loopback 测。。。
|
15
alexapollo 2015-08-11 16:42:55 +08:00
A server socket listens on a single port. All established client connections on that server are associated with that same listening port on the server side of the connection. An established connection is uniquely identified by the combination of client-side and server-side IP/Port pairs. Multiple connections on the same server can share the same server-side IP/Port pair as long as they are associated with different client-side IP/Port pairs, and the server would be able to handle as many clients as available system resources allow it to.
On the client-side, it is common practice for new outbound connections to use a random client-side port, in which case it is possible to run out of available ports if you make a lot of connections in a short amount of time. -- http://stackoverflow.com/questions/11129212/tcp-two-different-sockets-sharing-a-port |
16
xiyangyang 2015-08-11 18:40:35 +08:00
用多个服务器是肯定的了,关键代码和数据库怎么弄?
数据库必须是分布式的吗?还是可以像amazon的RDS?阿里云有类似的服务吗? |
17
usernametoolong 2015-08-12 12:31:18 +08:00
单点测试都不易实现,就别说模拟百万级的用户了。
|
18
chinawrj 2015-08-12 13:06:14 +08:00
iptables 可以配合pid match以及策略路由可以实现。简单点说就是:
1. iptables 在nat中的OUTPUT匹配包所属的pid并且做fwmark 2. ip rule add 添加fwmark匹配规则 3. ip route add 添加具体路由策略。 |