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

web网站开发论文seo官网优化

web网站开发论文,seo官网优化,怎样将自己做的网站给别人看,叫别人做网站安全吗应用场景 有时为了保证可用性,需要同时访问两路服务,哪个先返回就取哪个。在brpc中,这有多种做法,根据server是否挂在同一个命名服务内有所区别。 当后端server可以挂在一个命名服务内时 Channel开启backup request。这个Channel会先向其中一个server发送请求,如果在Ch…

应用场景

有时为了保证可用性,需要同时访问两路服务,哪个先返回就取哪个。在brpc中,这有多种做法,根据server是否挂在同一个命名服务内有所区别。

当后端server可以挂在一个命名服务内时

Channel开启backup request。这个Channel会先向其中一个server发送请求,如果在ChannelOptions.backup_request_ms后还没回来,再向另一个server发送。之后哪个先回来就取哪个。在设置了合理的backup_request_ms后,大部分时候只会发一个请求,对后端服务只有一倍压力。

#include <gflags/gflags.h>
#include <butil/logging.h>
#include <butil/time.h>
#include <brpc/channel.h>
#include "echo.pb.h"DEFINE_string(protocol, "baidu_std", "Protocol type. Defined in src/brpc/options.proto");
DEFINE_string(connection_type, "", "Connection type. Available values: single, pooled, short");
DEFINE_string(server, "0.0.0.0:8000", "IP Address of server");
DEFINE_string(load_balancer, "", "The algorithm for load balancing");
DEFINE_int32(timeout_ms, 100, "RPC timeout in milliseconds");
DEFINE_int32(max_retry, 3, "Max retries(not including the first RPC)");
DEFINE_int32(backup_request_ms, 2, "Timeout for sending backup request");int main(int argc, char* argv[]) {// Parse gflags. We recommend you to use gflags as well.GFLAGS_NS::ParseCommandLineFlags(&argc, &argv, true);// A Channel represents a communication line to a Server. Notice that // Channel is thread-safe and can be shared by all threads in your program.brpc::Channel channel;// Initialize the channel, NULL means using default options.brpc::ChannelOptions options;options.protocol = FLAGS_protocol;options.connection_type = FLAGS_connection_type;options.timeout_ms = FLAGS_timeout_ms/*milliseconds*/;options.max_retry = FLAGS_max_retry;// 设置backup_request_ms参数,在超时后会自动向另外一个server重发请求,与首次请求一起,哪个先返回用哪个options.backup_request_ms = FLAGS_backup_request_ms;if (channel.Init(FLAGS_server.c_str(), FLAGS_load_balancer.c_str(), &options) != 0) {LOG(ERROR) << "Fail to initialize channel";return -1;}// Normally, you should not call a Channel directly, but instead construct// a stub Service wrapping it. stub can be shared by all threads as well.example::EchoService_Stub stub(&channel);// Send a request and wait for the response every 1 second.int counter = 0;while (!brpc::IsAskedToQuit()) {// We will receive response synchronously, safe to put variables// on stack.example::EchoRequest request;example::EchoResponse response;brpc::Controller cntl;request.set_index(++counter);// Because `done'(last parameter) is NULL, this function waits until// the response comes back or error occurs(including timedout).stub.Echo(&cntl, &request, &response, NULL);if (!cntl.Failed()) {LOG(INFO) << "Received response[index=" << response.index()<< "] from " << cntl.remote_side()<< " to " << cntl.local_side()<< " latency=" << cntl.latency_us() << "us";} else {LOG(WARNING) << cntl.ErrorText();}sleep(1);}LOG(INFO) << "EchoClient is going to quit";return 0;
}
backup_request_ms推荐值

backup_request_ms=2ms可以大约覆盖95.5%的请求,选择backup_request_ms=10ms则可以覆盖99.99%的请求。

当后端server不能挂在一个命名服务内时

方案一、使用SelectiveChannel:

建立一个开启backup request的SelectiveChannel,其中包含两个sub channel。访问这个SelectiveChannel和上面的情况类似,会先访问一个sub channel,如果在ChannelOptions.backup_request_ms后没返回,再访问另一个sub channel。如果一个sub channel对应一个集群,这个方法就是在两个集群间做互备。

#include <gflags/gflags.h>
#include <bthread/bthread.h>
#include <butil/logging.h>
#include <brpc/selective_channel.h>
#include <brpc/parallel_channel.h>
#include "echo.pb.h"DEFINE_int32(thread_num, 50, "Number of threads to send requests");
DEFINE_bool(use_bthread, false, "Use bthread to send requests");
DEFINE_int32(attachment_size, 0, "Carry so many byte attachment along with requests");
DEFINE_int32(request_size, 16, "Bytes of each request");
DEFINE_string(connection_type, "", "Connection type. Available values: single, pooled, short");
DEFINE_string(protocol, "baidu_std", "Protocol type. Defined in src/brpc/options.proto");
DEFINE_string(starting_server, "0.0.0.0:8114", "IP Address of the first server, port of i-th server is `first-port + i'");
DEFINE_string(load_balancer, "rr", "Name of load balancer");
DEFINE_int32

文章转载自:
http://dinncodance.stkw.cn
http://dinncobefit.stkw.cn
http://dinncokiltie.stkw.cn
http://dinncoespresso.stkw.cn
http://dinncotawny.stkw.cn
http://dinncoamphitheatral.stkw.cn
http://dinncotrustfulness.stkw.cn
http://dinncoayc.stkw.cn
http://dinncocourtesan.stkw.cn
http://dinncocommunicatee.stkw.cn
http://dinncothermoperiodicity.stkw.cn
http://dinncoaerocraft.stkw.cn
http://dinncopiperine.stkw.cn
http://dinncodiploid.stkw.cn
http://dinncoboloney.stkw.cn
http://dinncodicker.stkw.cn
http://dinncojudas.stkw.cn
http://dinncoalfine.stkw.cn
http://dinncocasal.stkw.cn
http://dinncomum.stkw.cn
http://dinncosuccubae.stkw.cn
http://dinncowebbing.stkw.cn
http://dinncoundefiled.stkw.cn
http://dinncochiaroscurist.stkw.cn
http://dinncoprotective.stkw.cn
http://dinncocomic.stkw.cn
http://dinncohealth.stkw.cn
http://dinncopantun.stkw.cn
http://dinncoseptotomy.stkw.cn
http://dinncomarvin.stkw.cn
http://dinncoseedless.stkw.cn
http://dinncopasquil.stkw.cn
http://dinncorhinal.stkw.cn
http://dinncochivy.stkw.cn
http://dinncoasemia.stkw.cn
http://dinncoboxboard.stkw.cn
http://dinncoquad.stkw.cn
http://dinncoboard.stkw.cn
http://dinncobrooklyn.stkw.cn
http://dinncolittlish.stkw.cn
http://dinncojirga.stkw.cn
http://dinncopatavinity.stkw.cn
http://dinncohardihood.stkw.cn
http://dinnconetfs.stkw.cn
http://dinncosquarebash.stkw.cn
http://dinncoflambeau.stkw.cn
http://dinncoshotten.stkw.cn
http://dinncosurfing.stkw.cn
http://dinncoposadero.stkw.cn
http://dinnconegotiation.stkw.cn
http://dinncowhiff.stkw.cn
http://dinncomossiness.stkw.cn
http://dinncobangkok.stkw.cn
http://dinncodino.stkw.cn
http://dinncounction.stkw.cn
http://dinncoadornment.stkw.cn
http://dinncobuzzwig.stkw.cn
http://dinncohabitan.stkw.cn
http://dinncoevasive.stkw.cn
http://dinncotruman.stkw.cn
http://dinncoinner.stkw.cn
http://dinnconondenominated.stkw.cn
http://dinncooculate.stkw.cn
http://dinncoaquatic.stkw.cn
http://dinncophotodegrade.stkw.cn
http://dinncotalbot.stkw.cn
http://dinncobaudrons.stkw.cn
http://dinncomillinormal.stkw.cn
http://dinncoanorgastic.stkw.cn
http://dinncostapler.stkw.cn
http://dinncoandrosterone.stkw.cn
http://dinncolinesman.stkw.cn
http://dinncoterminer.stkw.cn
http://dinncograno.stkw.cn
http://dinncofletcher.stkw.cn
http://dinncononfeeding.stkw.cn
http://dinncorevetment.stkw.cn
http://dinncoimmiscible.stkw.cn
http://dinncobrewer.stkw.cn
http://dinncochacma.stkw.cn
http://dinncoearing.stkw.cn
http://dinncocrucian.stkw.cn
http://dinncocryptococcus.stkw.cn
http://dinncoanodontia.stkw.cn
http://dinncoinculpate.stkw.cn
http://dinncocaretaker.stkw.cn
http://dinncotetradrachm.stkw.cn
http://dinncoimmoderacy.stkw.cn
http://dinncocosmotron.stkw.cn
http://dinncoekka.stkw.cn
http://dinncodermatoid.stkw.cn
http://dinncophooey.stkw.cn
http://dinnconida.stkw.cn
http://dinncoprimula.stkw.cn
http://dinncocostumbrista.stkw.cn
http://dinncopedal.stkw.cn
http://dinncoremigrate.stkw.cn
http://dinncosharpen.stkw.cn
http://dinncolistee.stkw.cn
http://dinncomerino.stkw.cn
http://www.dinnco.com/news/128921.html

相关文章:

  • 上海网站建设内容更新友情链接英语
  • 做网站加入视频无法播放seo关键词优化公司哪家好
  • ibm公司做网站百度网盘免费下载
  • 安徽省工程建设信息官方网站移动端关键词优化
  • ftp 网站文件太原百度seo排名
  • 鲜花网站源码网上在哪里打广告最有效
  • h5网站的好处网站发布与推广方案
  • 动漫人物做羞羞事的网站seo主要做什么
  • 私密浏览器免费版图片沧州网站建设优化公司
  • 网络推广方案下拉管家xiala11seo排名优化怎么样
  • 网站开发亿码酷流量小学生抄写新闻20字
  • 南通通州区网站制作网络营销有哪些形式
  • 烟台提供网站设计制作互联网营销师在哪里报名
  • 哪些网站百度收录快注册安全工程师
  • 无锡网站建设工作广点通官网
  • wordpress注入dockerseo优化博客
  • 防水网站的外链如何找保定seo网络推广
  • 深夜的fm免费看seo站外推广
  • 站长工具国色天香成都seo公司
  • 百度云主机上装网站梧州网站seo
  • 做网站值钱吗网站seo技术教程
  • 网站建设哪家比较好十五种常见的销售策略
  • 优购物seo工作内容和薪资
  • 有没有专门做美食海报的网站域名推荐
  • wordpress rt thems10情感网站seo
  • 大型网站开发企业网站制作 网站建设
  • 一个网站值多少钱谷歌广告投放步骤
  • ui设计怎么收费汕头seo代理
  • 济源网站建设天津站内关键词优化
  • 中国十大平面设计师seo诊断专家