Linux implementation principle – multi-thread scheduling overhead and performance optimization in NUMA multi-core architecture

Foreword NOTE: The “thread” referred to in this article refers to the executable scheduling unit Kernel Thread. NUMA Architecture The design concept of NUMA (Non-Uniform Memory Access, non-uniform memory access) is to partition the CPU and Main Memory autonomously (Local NUMA node), and to cooperate across regions (Remote NUMA node), in this way to alleviate […]

book bookstore project (registration function): three-tier architecture of JavaEE project

The purpose of layering is to decouple. Decoupling is to reduce the coupling of the code. Convenient for later maintenance and upgrades of the project. web layer com.ydgk.web/servlet/controller service layer com.ydgk.service Service interface package com.ydgk.service.impl Service interface implementation class dao persistence layer com.ydgk.dao Dao interface package com.ydgk.dao.impl Dao interface implementation class Entity bean object com.ydgk.pojo/entity/domain/bean […]

Based on the arm architecture diagram, the smart box (T906G) ubuntu20.04 builds open-ai Whisper and realizes speech to text.

Foreword The arm architecture is really not fun. You can’t just rely on Baidu for strange error reports. Google is a must. Don’t be afraid of foreign blogs. Text 1. Hardware introduction The picture shows the built-in ubuntu20.04 system of the smart box. The built-in default python is 3.8. There is an nvidia graphics card, […]

Using MyBatis in WEB applications (using the MVC architecture pattern)

2023.10.30 This chapter will use MyBatis in a web application to implement a bank transfer function. The overall architecture adopts the MVC architecture pattern. Initialization of database tables Initial configuration of the environment Configuration of web.xml file: <?xml version=”1.0″ encoding=”UTF-8″?> <web-app xmlns=”http://xmlns.jcp.org/xml/ns/javaee” xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xsi:schemaLocation=”http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd” version=”4.0″ metadata-complete=”false”> <!– <servlet>–> <!– <servlet-name>test</servlet-name>–> <!– <servlet-class>bank.web.AccountServlet</servlet-class>–> <!– </servlet>–> […]

Spring-core concepts of underlying architecture

Spring underlying core components BeanDefinition BeanDefinition represents Bean definition. There are many attributes used to describe the characteristics of Bean: class, indicating the Bean type scope, indicating Bean scope, singleton or prototype, etc. lazyInit: indicates whether the Bean is lazy loaded initMethodName: Indicates the method to be executed when the Bean is initialized. destroyMethodName: Indicates […]

Generative AI – application architecture and solutions based on large models

This article explores the process of building language model (LLM)-based applications using document loaders, embeddings, vector stores, and hint templates. Due to its ability to generate coherent and contextual text, LLM is becoming increasingly popular in natural language processing tasks. This article discusses the importance of LLM, compares fine-tuning and context injection methods, introduces LangChain, […]

Spring Security: overall architecture

Filter Spring Security is implemented based on Sevlet Filter. The following is a diagram of an Http request starting from the client and interacting with the Servlet: When the client sends a request to the application, the container will create a FilterChain, which contains multiple Filter and Servlet >. These Filter and Servlet are used […]

Multi-level cache in microservice architecture should be designed like this!

Thisisacommunitythatmaybeusefultoyou One-to-onecommunication/interviewbrochure/resumeoptimization/jobsearchquestions,welcometojointhe”YudaoRapidDevelopmentPlatform“KnowledgePlanet.ThefollowingissomeinformationprovidedbyPlanet: “ProjectPractice(Video)”:Learnfrombooks,“practice”frompastevents “InternetHighFrequencyInterviewQuestions”:Studyingwithyourresume,springblossoms “ArchitecturexSystemDesign”:Overcomingdifficultiesandmasteringhigh-frequencyinterviewscenarioquestions “AdvancingJavaLearningGuide”:systematiclearning,themainstreamtechnologystackoftheInternet “Must-readJavaSourceCodeColumn”:Knowwhatitisandwhyitisso Thisisanopensourceprojectthatmaybeusefultoyou DomesticStarisa100,000+opensourceproject.Thefront-endincludesmanagementbackend+WeChatapplet,andtheback-endsupportsmonomerandmicroservicearchitecture. FunctionscoverRBACpermissions,SaaSmulti-tenancy,datapermissions,mall,payment,workflow,large-screenreports,WeChatpublicaccount,etc.: Bootaddress:https://gitee.com/zhijiantianya/ruoyi-vue-pro Cloudaddress:https://gitee.com/zhijiantianya/yudao-cloud Videotutorial:https://doc.iocoder.cn Source:Internet Multi-levelcachedesigninmicroservicearchitecture clientcache Applicationlayercaching CDNContentDeliveryNetwork Nginxcachemanagement Servicelayercaching In-processcache Distributedcacheservice Ensurecacheconsistency summary Todaywewilltalkaboutthetopicofcachingandseehowtodesignaneffectivemulti-levelcachearchitectureinamicroserviceenvironment.Itmainlyinvolvesthreeaspects: Client-sidecachingforwebapplications; Applicationlayerstaticresourcecaching; Servicelayermulti-levelcaching. First,let’sexplainthemulti-levelcachedesignofmicroservicearchitecture. Multi-levelcachedesigninmicroservicearchitecture Whenitcomestocaching,everysoftwareengineermustbefamiliarwithit.Itisthemostdirectwaytoimproveperformanceincurrentarchitecturedesign.Herewegiveanexample: Rediscache AssumethattheapplicationstoresrawdatainaMySQLdatabase.Asweallknow,theMySQLdatabasestoresdataontheharddisktopreventlossduetopowerfailure.However,duetothephysicaldesignoftheharddisk,eventhebest-performingenterprise-classSSDharddiskisanorderofmagnitudeworsethantheIOlevelofhigh-speeddevicessuchasmemory.Internetapplicationsrepresentedbye-commercecompaniessuchasTaobaoandJD.comaretypicalscenariosof”morereadingandlesswriting”.Therefore,weneedtoseparatethereadingandwritingofdatainthedesign.Whendataisloaded,itisdirectlyplacedonthediskforprocessing,whilemorethan90%ofthedatareadingoperationsareextractedfromthein-memoryNoSQLdatabaserepresentedbyRedis,andthehighthroughputofthememoryisusedtocompletethedataextractioninstantly.TheroleofRedishereiswhatweoftensaycache. Ofcourse,cachingisnotjustaformofreplacingharddiskswithmemory.Inadistributedarchitecture,cachinghasitsowndesignateachlayer.Let’sexplainitthroughthemulti-levelcachearchitecturediagramofthismicroserviceasthemainline. OverviewofXcachemulti-levelcachearchitecture Thisdiagramcontainsfourlayersfromtoptobottom:Client,applicationlayer,servicelayeranddatalayer. Backendmanagementsystem+userappletimplementedbasedonSpringBoot+MyBatisPlus+Vue&Element,supportingRBACdynamicpermissions,multi-tenancy,datapermissions,workflow,three-partylogin,payment,SMS,mallandotherfunctions Projectaddress:https://github.com/YunaiV/ruoyi-vue-pro Videotutorial:https://doc.iocoder.cn/video/ Clientcache TheXmallclientisabrowser.Atthebrowserlevel,wemainlycachestaticresourcessuchasimages,CSS,JS,andfontsinHTML. browsercache Let’staketheBaiduLogoimageasanexample.BaiducontrolsthevalidityperiodofthestaticimagethroughtheExpiresresponseheaderinHTTP.Expiresrepresentsexpirationtime.ThecurrentBaiduLogoexpirationtimeisFebruary8,2031,9:26:31.Duringthisperiodoftime,thebrowserwillcachetheimagelocallyasafile.Whenyouvisitagain,youwillseetheprompt”fromdiskcache”.Atthistime,thebrowserwillnolongermakeanactualrequesttotheserverandwillreaditdirectlyfromthelocalcomputer.Getcachedimages.BysettingExpiresonthebrowserside,thebandwidthlosscausedbyrepeatedrequestsforstaticresourcescanbegreatlyreduced.Thisisabasicandimportantsettinginhigh-concurrencywebapplications. Backendmanagementsystem+userappletimplementedbasedonSpringCloudAlibaba+Gateway+Nacos+RocketMQ+Vue&Element,supportingRBACdynamicpermissions,multi-tenancy,datapermissions,workflow,three-partylogin,payment,SMS,mallandotherfunctions Projectaddress:https://github.com/YunaiV/yudao-cloud Videotutorial:https://doc.iocoder.cn/video/ Applicationlayercache SowhereisExpiresset?Forthebrowser,itisjustaclientandisonlyresponsibleforreadingtheExpiresresponseheader.Expiresmustbesetattheapplicationlayer,thatis,CDNandNginx. CDNContentDeliveryNetwork ThefullnameofCDNisContentDeliveryNetwork,whichisthecontentdistributionnetwork.ItisthemaintechnicalmeansforthedistributionofstaticresourcesontheInternet. CDNContentDeliveryNetwork Chinaisavastcountry,withthousandsofkilometersfromBeijingtoShanghai.IfalargenumberofShanghaiuserswanttoaccesstheresourcesofserversinBeijingthousandsofmilesawayatthesametime,suchalongcommunicationwillinevitablybringhighdelaysandmoreuncontrollablefactorsaffectingdatatransmission.IfthereissomemechanismthatallowsstaticfilesinBeijingtobecachedonserversinShanghai,Shanghaiuserscanautomaticallyaccessthenearestservertoobtainresources.Thiscangreatlyreducenetworklatencyandimprovesystemavailability.ThedistributedcachingtechnologyjustmentionedistheCDN(contentdistributionnetwork)weoftenmention. Forwide-areaInternetapplications,CDNisalmostanecessaryinfrastructure,whicheffectivelysolvestheproblemsofconcentratedbandwidthoccupationanddatadistribution.Staticresourcessuchasimages,audioandvideo,CSS,andJSinwebpagescanbeobtainedfromthenearestCDNserver. ThecoreofCDNtechnologyis”smartDNS”.SmartDNSwillautomaticallydeterminethenearestaccessCDNnodebasedontheuser’sIPaddress.Let’stakethefollowingfigureasanexample: CDNexecutionprocess […]