Netty OIO或NIO(Netty OIO or NIO)
我有多级网络基础设施。 第1层有8台服务器每秒从10000个客户端接收数据。 我想用大约2或3个实例编写代理层来将数据从第1层传输到后端层。
我发现Netty很方便我写这样的程序。 但我还是在NIO或OIO之间混淆,因为我只有8台服务器,同时在Netty的文件中说服务器的OIO连接低于1000,比应该使用NIO多。
我担心使用OIO会阻塞流并使某些消息延迟。 我需要在收到请求后立即回复客户。
愿任何人建议我解决方案,我是网络和Netty的新手。
I have multi stages network infrastructure. Layer 1 has 8 servers receive data from 10000 clients every second. I'd like to write proxy layer with about 2 or 3 instances to transfer data from layer 1 to backend layer.
I found Netty quite convenient for me to write such a program like this. But I still confuse between NIO or OIO, because I only have 8 servers, meanwhile in document of Netty says that OIO for server has lower than 1000 connection, more than that should use NIO.
I'm afraid that using OIO will block the stream and make some messages delay. I need to response to the clients instantaneously after receive the request.
May anyone suggest me the solution, I'm new to network and Netty.
原文:https://stackoverflow.com/questions/20637717
最满意答案
这应该工作。
<LinearLayout android:weightSum="2" android:layout_width="100dp" android:layout_height="wrap_content" android:orientation="vertical" xmlns:android="http://schemas.android.com/apk/res/android" > <ImageView android:layout_weight="1" android:id="@+id/horizontal_list_image" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" /> <TextView android:layout_weight="1" android:id="@+id/horizontal_list_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:text="FFFFFFFF" android:textSize="15sp"/> </LinearLayout>
This should work.
<LinearLayout android:weightSum="2" android:layout_width="100dp" android:layout_height="wrap_content" android:orientation="vertical" xmlns:android="http://schemas.android.com/apk/res/android" > <ImageView android:layout_weight="1" android:id="@+id/horizontal_list_image" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" /> <TextView android:layout_weight="1" android:id="@+id/horizontal_list_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:text="FFFFFFFF" android:textSize="15sp"/> </LinearLayout>
相关问答
更多-
在View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.post_comment_item, parent, false); null放置在父级中View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.post_comment_item, parent, false); I've already solved the issue. The proble ...
-
列表视图到Recycleview(Listview to Recycleview)[2023-01-20]
我修改了你的完整适配器类如下: public class GetAllAllarmiListViewAdapter extends RecyclerView.Adapter{ private JSONArray dataArray; private Activity activity; private static LayoutInflater inflater = null; // Provide a suitab ... -
如何根据显示打开全尺寸窗口。还应显示标题栏,最小化,交叉选项。 窗口小部件的最大化方法允许您以fullsize打开窗口并显示标题栏 如何设置宽度ID = 20%和名字:40%和姓氏:40%。这个所有列都是相同的。 我认为你的第二个和第三个问题是相同的,你可以使用3个循环视图而不是一个,每列一个 .py : ... from kivy.core.window import Window Window.maximize() ... class RV(BoxLayout): col1 = ListP ...
-
使用LinearLayout作为两个RecyclerViews父级 您还可以为两个RecyclerViews分配andorid:weight_sum ="1" 它将确保您的两个RecyclerViews都具有相同的尺寸,无论手机的屏幕尺寸有多大。 样品:
Android Studio:RecycleView中的项目“跳转”到左侧(Android Studio: Items in RecycleView “jumps” to the left)[2023-12-14]
好的,我终于明白了。 感谢@Eugen Pechanec(我希望我知道如何正确地提及你),因为布局督察告诉我说有什么问题。 所以,这是我的回收视图本身的代码:这应该工作。试试这个 int scrollX = recycleView.computeHorizontalScrollOffset(); Try with this int scrollX = recycleView.computeHorizontalScrollOffset();请告诉我们你的代码。 在rv.data中,您可以在未选择节点时添加参数'selected'= 0,如果是这样,则可以添加1: class TestRecycleView(RecycleView): def __init__(self, **kwargs): super(TestRecycleView, self).__init__(**kwargs) self.data = [{'name': 'test', 'ind':0,'selected': 0}] class Te ...RecycleView不会更新(RecycleView Wont update)[2022-10-30]
将您的代码更改为此 if (!tags.contains(tag)) { tags.add(tag); Collections.sort(tags, String.CASE_INSENSITIVE_ORDER); adapter.notifyDataSetChanged(); } 因为,以下条件总是错误的 if(!tag.contains(tag)) 这是因为您正在检查值是否包含在该值中。 所以它永远是真的。 如果您正在检查List... 基于此链接 属性singleline因其糟糕的性能而被弃用。 但是我使用了“textview.setSingleLine();” 相反,并没有弃用警告(源代码中也没有)。 所以我认为这可行。 当然,替代方式与列表中的倒数计时器相同,并且自定义视图应该是必要的,但不能避免吨的工作。 Based on this link attribute singleline is deprecated for its bad performance. But I used "textview.setSingleLine() ...相关文章
更多- [Netty 1] 初识Netty
- Netty源码分析
- Java NIO系列教程(一) Java NIO 概述
- Netty入门实例-时间服务器
- Netty环境配置
- Netty开发环境配置
- Java:IO/NIO篇,读写属性文件(properties)
- solr启动时报错java.nio.channels.OverlappingFileLockException
- storm学习之Netty代替ZMQ
- Netty基于流的传输处理
最新问答
更多- 在ios 7中的UITableView部分周围绘制边界线(draw borderline around UITableView section in ios 7)
- Java中的不可变类(Immutable class in Java)
- 寻求多次出现的表达式(Seeking for more than one occurrence of an expression)
- linux只知道文件名,不知道在哪个目录,怎么找到文件所在目录
- Actionscript:检查字符串是否包含域或子域(Actionscript: check if string contains domain or subdomain)
- 懒惰地初始化AutoMapper(Lazily initializing AutoMapper)
- 使用hasclass为多个div与一个按钮问题(using hasclass for multiple divs with one button Problems)
- Windows Phone 7:检查资源是否存在(Windows Phone 7: Check If Resource Exists)
- EXCEL VBA 基础教程下载
- RoR - 邮件中的动态主体(部分)(RoR - Dynamic body (part) in mailer)
- 无法在Google Script中返回2D数组?(Can not return 2D Array in Google Script?)
- JAVA环境变量的设置和对path , classpth ,java_home设置作用和目的?
- mysql 关于分组查询、时间条件查询
- 如何使用PowerShell匹配运算符(How to use the PowerShell match operator)
- Effective C ++,第三版:重载const函数(Effective C++, Third edition: Overloading const function)
- 如何用DELPHI动态建立MYSQL的数据库和表? 请示出源代码。谢谢!
- 带有简单redis应用程序的Node.js抛出“未处理的错误”(Node.js with simple redis application throwing 'unhandled error')
- 使用前端框架带来哪些好处,相对于使用jquery
- Ruby将字符串($ 100.99)转换为float或BigDecimal(Ruby convert string ($100.99) to float or BigDecimal)
- 高考完可以去做些什么?注意什么?
- 如何声明放在main之后的类模板?(How do I declare a class template that is placed after the main?)
- 如何使用XSLT基于兄弟姐妹对元素进行分组(How to group elements based on their siblings using XSLT)
- 在wordpress中的所有页面的标志(Logo in all pages in wordpress)
- R:使用rollapply对列组进行求和的问题(R: Problems using rollapply to sum groups of columns)
- Allauth不会保存其他字段(Allauth will not save additional fields)
- python中使用sys模块中sys.exit()好像不能退出?
- 将Int拆分为3个字节并返回C语言(Splitting an Int to 3 bytes and back in C)
- 在SD / MMC中启用DDR会导致问题吗?(Enabling DDR in SD/MMC causes problems? CMD 11 gives a response but the voltage switch wont complete)
- sed没有按预期工作,从字符串中间删除特殊字符(sed not working as expected, removing special character from middle of string)
- 如何将字符串转换为Elixir中的函数(how to convert a string to a function in Elixir)