首页 文章 精选 留言 我的

精选列表

搜索[招聘下降],共10003篇文章
优秀的个人博客,低调大师

【招聘信息】

神州优车集团平台团队常年招人,欢迎投递简历: 投递邮箱:he.ai@ucarinc.com QQ联系: 1741919901 各种岗位,Java高级/架构, 前端高级/架构。 位置 北京,厦门都可 Java岗位职责 主要参与神州优车集团大数据平台相关产品的研发 按照需求,完成产品的设计、开发和维护工作,并根据规范编写产品设计和使用文档 持续梳理和优化系统,构建可扩展、高并发、高可用的产品,以适应公司业务的高速发展 岗位要求 3年以上互联网服务端开发经验 计算机基础扎实,熟悉常用的数据结构和算法,深入掌握操作系统、数据库、网络等基础知识 Java基础扎实, 深入掌握IO、多线程、集合、jvm等基础知识,深入掌握MVC、IoC、ORM、RPC等主流框架 深入理解面向对象思想和常用设计模式,注重代码质量,有工匠精神和重构精神 热爱技术研发,具有快速学习能力,有良好的软件工程知识和编码规范意识 具有较好的沟通能力、思路清晰、善于思考、能独立分析和解决问题 有互联网大型系统开发经验优先 有贡献或研读过开源代码者优先

优秀的个人博客,低调大师

智能路由如何实现 90% 成本下降?

一、背景 随着大模型数量爆炸式增长,开发者面临一个经典问题:如何为每个任务选择最便宜且效果足够的模型?手动选择不可扩展,而简单规则(如“简单任务走小模型”)无法适应复杂多变的用户请求。 2025年,学术界和工业界开始系统研究LLM智能路由。其中,论文《Cost-Effective LLM Routing with Reinforcement Learning》(Chen et al., 2025)提出了一种基于强化学习的动态路由框架,实测在保持95%以上准确率的前提下,成本降低87%。 二、核心思想 传统路由依赖启发式规则(如关键词、长度),但无法处理模糊任务。该论文的核心贡献是: 质量预测器:训练一个小型模型,预测每个候选LLM在给定输入上的输出质量(分数0-100) 成本感知选择:在质量阈值内,选择成本最低的模型 在线学习:根据实际反馈(用户点赞、任务完成度)更新预测器 三、Token-Flow的工程实践 Token-Flow的智能路由模块借鉴了这一思想,并做了工程化改进: 实时延迟监控:除成本外,还考虑模型响应延迟 多目标优化:支持用户自定义约束(如“最大延迟2秒”) 降级策略:如果轻量模型质量低于阈值,自动升级到高性能模型 实测效果(基于10万次真实调用): 简单问答:92%走国产轻量模型(DeepSeek、智谱),成本降低96% 复杂推理:70%走GPT-4o/Claude,保证质量 综合成本降低:91.3% 四、开源生态与未来 目前已有多个开源路由项目(如RouteLLM、FrugalGPT),但它们在动态性、多目标优化上仍有局限。Token-Flow计划将其路由策略的核心算法部分开源,推动社区共建。 未来方向: 语义路由:基于任务嵌入向量而非规则 跨模态路由:文本/图像/视频模型统一调度 边缘路由:端侧小模型+云端大模型协同 五、讨论 智能路由正在成为大模型中间层的标准组件。它不仅降低了AI应用的成本门槛,也让“一人公司”能够用得起顶级模型。我们期待更多开源贡献者加入这个领域。 👉 欢迎讨论:你理想中的路由策略应该具备哪些能力?

优秀的个人博客,低调大师

go http 框架性能大幅下降原因分析

最近在开发一个web 框架,然后业务方使用过程中,跟我们说,压测qps 上不去,我就很纳闷,httprouter + net/http.httpserver , 性能不可能这么差啊,网上的压测结果都是10w qps 以上,几个middleware 至于将性能拖垮?后来一番排查,发现些有意思的东西。 首先,我就简单压测hello world, 每个请求进来,我日志都不打,然后,打开pprof ,显示的情况如下: 这里futex 怎么这么高?看着上面的一些操作,addtimer, deltimer 我想到以前的自己实现的定时器,这估计是超时引起的。然后检查版本,go1.9, 然后框架默认为每个conn 设置了4个timeout,readtimeout, writetimeout, idletimeout, headertimeout ,这直接导致了定时器在添加和删除回调的时候,锁的压力特别大。 下面我们分析下,正常的加超时操作,到底发生了些什么,下面是个最简单的例子,为了安全,每个连接设置超时。 package main import ( "fmt" "github.com/julienschmidt/httprouter" "log" "net/http" "time" ) func Index(w http.ResponseWriter, r *http.Request, _ httprouter.Params) { fmt.Fprint(w, "Welcome!\n") } func Hello(w http.ResponseWriter, r *http.Request, ps httprouter.Params) { fmt.Fprintf(w, "hello, %s!\n", ps.ByName("name")) } func main() { router := httprouter.New() router.GET("/", Index) router.GET("/hello/:name", Hello) srv := &http.Server{ ReadTimeout: 5 * time.Second, WriteTimeout: 10 * time.Second, ReadHeaderTimeout: 10 * time.Second, IdleTimeout: 10 * time.Second, Addr: "0.0.0.0:8998", Handler: router, } log.Fatal(srv.ListenAndServe()) } 其中,ListenAndServe() 在调用accept 每个连接后,会调用 server.serve(), 根据是否添加超时,调用conn.SetReadDeadline等函数,对应的是 net/http/server.go,如下: // Serve a new connection. func (c *conn) serve(ctx context.Context) { ... if tlsConn, ok := c.rwc.(*tls.Conn); ok { if d := c.server.ReadTimeout; d != 0 { c.rwc.SetReadDeadline(time.Now().Add(d)) // 设置读超时 } if d := c.server.WriteTimeout; d != 0 { c.rwc.SetWriteDeadline(time.Now().Add(d))// 设置写超时 } if err := tlsConn.Handshake(); err != nil { c.server.logf("http: TLS handshake error from %s: %v", c.rwc.RemoteAddr(), err) return } c.tlsState = new(tls.ConnectionState) *c.tlsState = tlsConn.ConnectionState() if proto := c.tlsState.NegotiatedProtocol; validNPN(proto) { if fn := c.server.TLSNextProto[proto]; fn != nil { h := initNPNRequest{tlsConn, serverHandler{c.server}} fn(c.server, tlsConn, h) } return } } ... 之后,con.SetReadDeadline 会调用 internal/poll/fd_poll_runtime.go的fd.setReadDeadline,最后调用runtime/netpoll.go 的poll_runtime_pollSetDeadline, 这个函数会链接成internal/poll.runtime_pollSetDeadline。这个函数比较关键: //go:linkname poll_runtime_pollSetDeadline internal/poll.runtime_pollSetDeadline func poll_runtime_pollSetDeadline(pd *pollDesc, d int64, mode int) { lock(&pd.lock) if pd.closing { unlock(&pd.lock) return } pd.seq++ // invalidate current timers // Reset current timers. if pd.rt.f != nil { deltimer(&pd.rt) pd.rt.f = nil } if pd.wt.f != nil { deltimer(&pd.wt) pd.wt.f = nil } // Setup new timers. if d != 0 && d <= nanotime() { d = -1 } if mode == 'r' || mode == 'r'+'w' { pd.rd = d } if mode == 'w' || mode == 'r'+'w' { pd.wd = d } if pd.rd > 0 && pd.rd == pd.wd { pd.rt.f = netpollDeadline pd.rt.when = pd.rd // Copy current seq into the timer arg. // Timer func will check the seq against current descriptor seq, // if they differ the descriptor was reused or timers were reset. pd.rt.arg = pd pd.rt.seq = pd.seq addtimer(&pd.rt) } else { if pd.rd > 0 { pd.rt.f = netpollReadDeadline // 设置读的定时回调 pd.rt.when = pd.rd pd.rt.arg = pd pd.rt.seq = pd.seq addtimer(&pd.rt) // 添加到系统定时器中 } if pd.wd > 0 { pd.wt.f = netpollWriteDeadline // 设置写的定时回调 pd.wt.when = pd.wd pd.wt.arg = pd pd.wt.seq = pd.seq addtimer(&pd.wt) // 添加到系统定时器中 } } // If we set the new deadline in the past, unblock currently pending IO if any. var rg, wg *g atomicstorep(unsafe.Pointer(&wg), nil) // full memory barrier between stores to rd/wd and load of rg/wg in netpollunblock if pd.rd < 0 { rg = netpollunblock(pd, 'r', false) } if pd.wd < 0 { wg = netpollunblock(pd, 'w', false) } unlock(&pd.lock) if rg != nil { netpollgoready(rg, 3) } if wg != nil { netpollgoready(wg, 3) } } 这里主要工作就是检查过期定时器,然后添加定时器,设置回调函数为netpollReadDeadline 或者netpollWriteDeadline。 从中可以看出添加和删除定时器操作为addtimer(&pd.rt), deltimer(&pd.rt)。 后面就是核心了,为啥加超时后这么慢,看下addtimer 的实现,timer 是个四叉小顶堆,每次添加一个超时,最后都需要对一个全局的timers 进行加锁,当qps 很高,一个请求,多次加锁,这性能能很高吗? type timer struct { i int // heap index // Timer wakes up at when, and then at when+period, ... (period > 0 only) // each time calling f(arg, now) in the timer goroutine, so f must be // a well-behaved function and not block. when int64 period int64 f func(interface{}, uintptr) arg interface{} seq uintptr } var timers struct { lock mutex gp *g created bool sleeping bool rescheduling bool sleepUntil int64 waitnote note t []*timer } //添加一个定时器 func addtimer(t *timer) { lock(&timers.lock) addtimerLocked(t) unlock(&timers.lock) } 解决锁冲突改怎么办?分段锁是很常见一个思路,在go1.10 后,timers 由一个,变成64个,定时器被打散到64个锁上去,自然锁冲突就降低了。看1.10的runtime/time.go 可以发现定义如下,每个p有单独的timer, 每个timer能被多个p使用: // Package time knows the layout of this structure. // If this struct changes, adjust ../time/sleep.go:/runtimeTimer. // For GOOS=nacl, package syscall knows the layout of this structure. // If this struct changes, adjust ../syscall/net_nacl.go:/runtimeTimer. type timer struct { tb *timersBucket // the bucket the timer lives in i int // heap index // Timer wakes up at when, and then at when+period, ... (period > 0 only) // each time calling f(arg, now) in the timer goroutine, so f must be // a well-behaved function and not block. when int64 period int64 f func(interface{}, uintptr) arg interface{} seq uintptr } // timersLen is the length of timers array. // // Ideally, this would be set to GOMAXPROCS, but that would require // dynamic reallocation // // The current value is a compromise between memory usage and performance // that should cover the majority of GOMAXPROCS values used in the wild. const timersLen = 64 //64个bucket // timers contains "per-P" timer heaps. // // Timers are queued into timersBucket associated with the current P, // so each P may work with its own timers independently of other P instances. // // Each timersBucket may be associated with multiple P // if GOMAXPROCS > timersLen. var timers [timersLen]struct { timersBucket // The padding should eliminate false sharing // between timersBucket values. pad [sys.CacheLineSize - unsafe.Sizeof(timersBucket{})%sys.CacheLineSize]byte } 下面是go1.10 后的timer 数据结构(此图来源于网络): 总结,网上很多httpserver 框架压测 qps 很高,但是它们的demo并没有设置超时,数据真实值会差很多。线上如果需要设置超时,需要注意go 的版本,qps 很高的情况下,最好使用1.10以上。最终我们不做任何其他操作情况下,仅将go 版本提高到1.10,qps 提高接近2倍。 本文来自云栖社区合作伙伴“开源中国” 本文作者:鼎铭 原文链接

资源下载

更多资源
Nacos

Nacos

Nacos /nɑ:kəʊs/ 是 Dynamic Naming and Configuration Service 的首字母简称,一个易于构建 AI Agent 应用的动态服务发现、配置管理和AI智能体管理平台。Nacos 致力于帮助您发现、配置和管理微服务及AI智能体应用。Nacos 提供了一组简单易用的特性集,帮助您快速实现动态服务发现、服务配置、服务元数据、流量管理。Nacos 帮助您更敏捷和容易地构建、交付和管理微服务平台。

Spring

Spring

Spring框架(Spring Framework)是由Rod Johnson于2002年提出的开源Java企业级应用框架,旨在通过使用JavaBean替代传统EJB实现方式降低企业级编程开发的复杂性。该框架基于简单性、可测试性和松耦合性设计理念,提供核心容器、应用上下文、数据访问集成等模块,支持整合Hibernate、Struts等第三方框架,其适用范围不仅限于服务器端开发,绝大多数Java应用均可从中受益。

Rocky Linux

Rocky Linux

Rocky Linux(中文名:洛基)是由Gregory Kurtzer于2020年12月发起的企业级Linux发行版,作为CentOS稳定版停止维护后与RHEL(Red Hat Enterprise Linux)完全兼容的开源替代方案,由社区拥有并管理,支持x86_64、aarch64等架构。其通过重新编译RHEL源代码提供长期稳定性,采用模块化包装和SELinux安全架构,默认包含GNOME桌面环境及XFS文件系统,支持十年生命周期更新。

Sublime Text

Sublime Text

Sublime Text具有漂亮的用户界面和强大的功能,例如代码缩略图,Python的插件,代码段等。还可自定义键绑定,菜单和工具栏。Sublime Text 的主要功能包括:拼写检查,书签,完整的 Python API , Goto 功能,即时项目切换,多选择,多窗口等等。Sublime Text 是一个跨平台的编辑器,同时支持Windows、Linux、Mac OS X等操作系统。

用户登录
用户注册