当前位置: 首页 > news >正文

中山做网站的seo关键词优化怎么做

中山做网站的,seo关键词优化怎么做,微博网站开发与设计开题报告,jsp和html做的招聘网站NetMQ是一个封装了Socket队列的开源库,他是ZeroMQ的.net移植版,而ZeroMQ是用C写成的,有人测试过他的性能,几乎可以秒杀其他所有的MQ(MSMQ,RabitMQ等等,都不是他的对手),不过他也有一…

NetMQ是一个封装了Socket队列的开源库,他是ZeroMQ的.net移植版,而ZeroMQ是用C写成的,有人测试过他的性能,几乎可以秒杀其他所有的MQ(MSMQ,RabitMQ等等,都不是他的对手),不过他也有一个弱点,消息不支持持久化!

定义要发送到消息里的对象

 1 using System;
 2 using ProtoBuf;
 3  
 4 namespace Model
 5 {
 6     [Serializable]
 7     [ProtoContract]
 8     public class Person
 9     {
10         [ProtoMember(1)]
11         public int Id { get; set; }
12         [ProtoMember(2)]
13         public string Name { get; set; }
14         [ProtoMember(3)]
15         public DateTime BirthDay { set; get; }
16         [ProtoMember(4)]
17         public Address Address { get; set; }
18     }
19 }
using System;
using ProtoBuf;namespace Model
{[Serializable][ProtoContract]public class Address{[ProtoMember(1)]public string Line1 { get; set; }[ProtoMember(2)]public string Line2 { get; set; }}
}

消息的发送者

using System;
using System.IO;
using System.Runtime.Remoting.Channels;
using System.Runtime.Serialization.Formatters.Binary;
using System.Threading;
using System.Threading.Tasks;
using Model;
using NetMQ;
using ProtoBuf;
using ProtoBuf.Meta;namespace Ventilator
{sealed class Ventilator{public void Run(){Task.Run(() =>{using (var ctx = NetMQContext.Create())using (var sender = ctx.CreatePushSocket())using (var sink = ctx.CreatePushSocket()){sender.Bind("tcp://*:5557");sink.Connect("tcp://localhost:5558");sink.Send("0");Console.WriteLine("Sending tasks to workers");RuntimeTypeModel.Default.MetadataTimeoutMilliseconds = 300000;//send 100 tasks (workload for tasks, is just some random sleep time that//the workers can perform, in real life each work would do more than sleepfor (int taskNumber = 0; taskNumber < 10000; taskNumber++){Console.WriteLine("Workload : {0}", taskNumber);var person = new Person{Id = taskNumber,Name = "First",BirthDay = DateTime.Parse("1981-11-15"),Address = new Address { Line1 = "Line1", Line2 = "Line2" }};using (var sm = new MemoryStream()){//Serializer.PrepareSerializer<Person>();//Serializer.Serialize(sm, person);//sender.Send(sm.ToArray());var binaryFormatter = new BinaryFormatter();binaryFormatter.Serialize(sm, person);sender.Send(sm.ToArray());}}}});}}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using NetMQ;namespace Ventilator
{public class Program{public static void Main(string[] args){// Task Ventilator// Binds PUSH socket to tcp://localhost:5557// Sends batch of tasks to workers via that socketConsole.WriteLine("====== VENTILATOR ======");Console.WriteLine("Press enter when worker are ready");Console.ReadLine();//the first message it "0" and signals start of batch//see the Sink.csproj Program.cs file for where this is usedConsole.WriteLine("Sending start of batch to Sink");var ventilator = new Ventilator();ventilator.Run();Console.WriteLine("Press Enter to quit");Console.ReadLine();}}
}

消息的处理者

using System;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
using System.Threading;
using System.Threading.Tasks;
using Model;
using NetMQ;
using ProtoBuf;namespace Worker
{sealed class Worker{public void Run(){Task.Run(() =>{using (NetMQContext ctx = NetMQContext.Create()){//socket to receive messages onusing (var receiver = ctx.CreatePullSocket()){receiver.Connect("tcp://localhost:5557");//socket to send messages onusing (var sender = ctx.CreatePushSocket()){sender.Connect("tcp://localhost:5558");//process tasks foreverwhile (true){//workload from the vetilator is a simple delay//to simulate some work being done, see//Ventilator.csproj Proram.cs for the workload sent//In real life some more meaningful work would be done//string workload = receiver.ReceiveString();var receivedBytes = receiver.Receive();using (var sm = new MemoryStream(receivedBytes)){//Protobuf.net 序列化在多线程方式下报错:/*Timeout while inspecting metadata; this may indicate a deadlock. This can often be avoided by preparing necessary serializers during application initialization, rather than allowing multiple threads to perform the initial metadata inspection; please also see the LockContended event*///var person = Serializer.Deserialize<Person>(sm);//采用二进制方式var binaryFormatter = new BinaryFormatter();var person = binaryFormatter.Deserialize(sm) as Person;Console.WriteLine("Person {Id:" + person.Id + ",Name:" + person.Name + ",BirthDay:" +person.BirthDay + ",Address:{Line1:" + person.Address.Line1 +",Line2:" + person.Address.Line2 + "}}");Console.WriteLine("Sending to Sink:" + person.Id);sender.Send(person.Id + "");}//simulate some work being done//Thread.Sleep(int.Parse(workload));
                            }}}}});}}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;namespace Worker
{public class Program{public static void Main(string[] args){// Task Worker// Connects PULL socket to tcp://localhost:5557// collects workload for socket from Ventilator via that socket// Connects PUSH socket to tcp://localhost:5558// Sends results to Sink via that socketConsole.WriteLine("====== WORKER ======");//Task 方式多线程//foreach (Worker client in Enumerable.Range(0, 1000).Select(//    x => new Worker()))//{//    client.Run();//}//多核计算方式多线程var actList =Enumerable.Range(0, 50).Select(x => new Worker()).Select(client => (Action)(client.Run)).ToList();var paraOption = new ParallelOptions { MaxDegreeOfParallelism = Environment.ProcessorCount };Parallel.Invoke(paraOption, actList.ToArray());Console.ReadLine();}}
}

 

转载于:https://www.cnblogs.com/asd14828/p/10135748.html

http://www.lbrq.cn/news/2627209.html

相关文章:

  • 物业管理系统功能结构图seo专员工资一般多少
  • 武汉网站设计方案南京网站设计优化公司
  • 初中做历史的网站小说关键词生成器
  • 外贸渠道有哪些网站seo技术能不能赚钱
  • 怎么做网站表白seo顾问推推蛙
  • 黄页网页的推广网站下载四平网络推广
  • 有备案号的网站是公司的吗重庆百度关键词推广
  • 北京网站开发公司推广平台怎么找客源
  • 电商网站模板html百度联盟官网
  • 晋城市住房保障和城乡建设局网站广告多的网站
  • 柳州建站百度关键词屏蔽
  • 广州市网站建设制作费用广州网站运营
  • 义乌网站制作多少钱关键词查询爱站网
  • 建设官方网站网站seo优化方案策划书
  • 什么是优化型网站优化公司流程制度
  • 芬兰网站后缀网络广告案例
  • 加盟连锁短视频seo排名系统
  • 赣州睿行网络科技有限公司北京优化互联网公司
  • 个人能免费做网站goole官网
  • 芜湖做网站推广有哪些公司百度荤seo公司
  • 计算机网站开发课本站长统计app进入网址新版
  • 营销型网站什么意思网络营销期末考试题库
  • 澄迈网站建设网络外包运营公司
  • 一流 北京网站建设网页制作步骤
  • 长春建站模板搭建百度 营销怎么收费
  • 济宁网站建设神华科技百度搜索排名优化
  • 坪山网站建设重大新闻事件2023
  • 武威网页设计培训学校百度推广优化排名怎么收费
  • 阜创汇网站建设名额最新国际新闻头条今日国际大事件
  • 网站编程工具可以免费领取会员的软件
  • 【性能测试】---测试工具篇(jmeter)
  • 视觉语言模型的空间推理缺陷——AI 在医学扫描中难以区分左右
  • 全栈:如何操作在SQLserver里面CRUD(增删改查)
  • 快速搭建开源网页编辑器(vue+TinyMCE)
  • 嵌入式硬件中MOSFET基本原理与实现
  • 北京-4年功能测试2年空窗-报培训班学测开-第六十九天-投简历第一天-从兴奋到害怕