How to fix 503 Service Unavailable Error in WordPress (2022)

文章推薦指數: 80 %
投票人數:10人

How To Fix 503 Service Unavailable Errors When Using WordPress (Hint: It Means Your Website Is Exceeding CPU Usage + Inode Limits). Skiptocontent HowToFix503ServiceUnavailableErrorsWhenUsingWordPress(Hint:ItMeansYourWebsiteIsExceedingCPUUsage+InodeLimits) 0Comments TomDupuis LastUpdated:January2,2022 503errorsarefrustrating.Luckily,they’reeasytounderstand(andhopefullyfix)usingthistutorial. 503serviceunavailableerrorsmeanyourWordPresssiteisexceedingCPUlimitswhicharesetbyyourhostingcompany.Often,moreexpensivehostingplansincludemoreserverresources(whichshouldfixthis),buttherearealsoplentyofthingsyoucandooutsideofspendingmoney. Besidesupgrading,youcanfix503errorsbyreducingCPUconsumedbyyourwebsite,plugins,andtheme.StartbyusingtoolslikeQueryMonitorandChromeDevToolstofindhighCPUtasks.However,somebackgroundtasks(i.e.WordPressHeartbeat,backupplugins,etc)maynotappearinthesereportsbutstillconsumehighCPU.Soit’sbesttogothroughtheentirelistandoptimizeyourwebsiteasbestyoucan.Whenyou’redone,recheckyourCPUusageinyourhostingaccount,andifitdecreases,youshouldn’tget503serviceunavailableerrorsanymore. Somehostingcompaniesthrottleyourbandwidth(resultingin503errors)whileotherhostslikeSiteGroundwillsendyouemailwarnings,thentakedownyourwebsiteuntilyouupgrade. CheckCPUUsageInYourHostingAccount FindHighCPUTasks AvoidHighCPUWordPressPlugins UpgradePHPVersion IncreaseMemoryLimit OffloadResourcesToCDNs DisableWordPressHeartbeat RemoveDatabaseJunk DisableResource-HungryBackgroundTasks Don’tUseWooCommerceOnSharedHosting Don’tUseSlowPageBuildersOnSharedHosting BlockBadBotsFromHittingYourServer DisableCachePluginSettingsThatRisk503Errors ProtectYourWP-loginPage DeleteUnusedThemesAndPlugins KeepEmailAndWebHostingSeparate RemoveBloatFromTheWordPressAdmin DisableWP-CronAndReplaceWithRealCronJobs 503ErrorsOnSharedHosting(GoDaddy,Bluehost,Hostinger) MoveToFasterHostingWhoDoesn’tHaveStrictCPULimits   1.CheckCPUUsageInYourHostingAccount MosthostingdashboardsletyoucheckCPUusage. CPUusageshouldneverbeabove80%sinceyouwantyourservertoberelaxed. Somehostingcompaniesalsohavea“featurespage”wheretheylisthowmanyinodesandserverresourcesareincludedwithyourplan.ByviewingtheCPUgraphandresourcelimits,itwon’tdiagnosetheproblem,butitgivesyouabenchmarkwhenyoustartoptimizingyoursite.   2.FindHighCPUTasks Therearemultipletoolsyoucanusetolearnwhat’scausinghighCPU. QueryMonitor–findyourslowestloadingpluginsinthe“queriesbycomponents”tab.Canalsobeusedtofindslowqueries,scripts,andotherthingsslowingdownyourwebsite.JustmakesureyoudeleteQueryMonitorwhenyou’redonesincethepluginitselfcanalsoincreaseCPU. ChromeDevTools–usethecoveragetabtoseewhichJS/CSSiscausinghighCPU. TTFB–503errorsusuallyresultinaslowTTFBsinceyourbandwidthisthrottled.ButifyoualwaysfindyourTTFBisslow(whichyoucanmeasureinPageSpeedInsights,WebPageTest,andothertools),thenIwoulddefinitelyswitchhosts.GoogleflagsyourTTFBifit’sover600ms.   3.AvoidHighCPUWordPressPlugins ThefollowingtypesofpluginsarenotoriousforincreasingCPUand503errors: Backups BrokenLinkChecker Gallery Security SEO Socialsharing Statistics Seemyfulllistofslowplugins.Somepluginsareonlyslowonthefrontend(usuallybecauseitaddsextraCSS,JavaScript,andthird-partyfonts).Butotherpluginsonlyimpactmemoryusage. PluginCategoryMemoryImpactPageSpeedImpact AnalytifyAnalyticsX✓ BackupBuddyBackupX✓ iThemesSecuritySecurityX✓ BrokenLinkCheckerSEOX✓ JetpackSecurityXX QueryMonitorAnalyticsX✓ NextGENGalleryGalleryXX SiteKitbyGoogleAnalyticsX✓ WordfenceSecurityX✓ wpDiscuzCommentsXX WPMLTranslateXX YoastSEOSEOX✓ QueryMonitorshowsyourhighestCPUplugins,butifyouwanttolearnwhetherapluginimpactsmemoryusagebeforeinstallingit,theWPHiveChromeExtensionisaverysolidtool.   4.UpgradePHPVersion HigherPHPversionsarefasterandmoreefficient. LogintoyourhostingaccountandfindthesettingtoupgradePHPversions.IsuggestPHP8.0ifyoucan,butsomeplugins+themesaren’tcompatibleyet(7.4isstillfastandmorecompatible).Ifthiscausesvisualerrorsonyourwebsite,youcanalwaysreverttoyourpreviousPHPversion.   5.IncreaseMemoryLimit Increasingyourmemorylimitcanpotentiallyfix503serviceunavailableerrors. Sometimes,you’llhavethisoptiondirectlyinyourhostingaccount.Othertimes,youwillneedtoedityourwp-config.phpfileandpastethecodebeforethelinethatsays,“HappyBlogging”: define('WP_MEMORY_LIMIT','512M');   6.OffloadResourcesToCDNs HowdoCDNsfix503errors? Becauseyou’reoffloadingresourcestotheCDN’sdatacenterswhichlightenstheloadonyouroriginserver.MostCDNshaveanAnalyticstabwhereyouseetheamountofbandwidthsaved. Cloudflare(free)andBunnyCDN(paidandwhatIuse)are2popularWordPressCDNs.QUIC.cloud’sCDNisalsogoodifyou’reusingaLiteSpeedserverwiththeLiteSpeedCacheplugin.Cloudflareisactivatedbychangingyourdomainfrom“DNSOnly”to“Proxied”intheDNStab.BunnyCDNissetupusingaCDNURLaswellastheirBunnyCDNplugin.QUIC.cloudissetupinLiteSpeedCache.Youcanalwayscheckcdnperf.comtoseetheperformanceofpopularCDNs(Idon’trecommendStackPathwhichisalsousedbyWPRocket’sRocketCDN).   7.DisableWordPressHeartbeat TheHeartbeatAPIrunsevery15-60sinthefrontend,backend,andeditor. Thisconsumesalotofserverresourcesandshouldbedisabledcompletely,oratleastreduced.Youcandothismanuallywithcode,butmostcachingandoptimizationpluginshaveanoptiontocontrolit.Irecommend120s(frontend),0(backend),and60(editor).ThiswillincreasetheintervalwheretheHeartbeatisneeded,anddisableitinthebackendwhereit’snotbeingused.   8.RemoveDatabaseJunk Asidefromthe“basic”thingsmostcachepluginsclean,youwouldn’tbelievetheamountofjunkthataccumulatesinyourdatabasefromoldpluginsyoudeletedorevencertainpluginfeatures. WP-Optimizeletsyouviewyourplugintablesanddeletetablesfromoldpluginsthataren’tinstalledanymoreshownas“NotInstalled.”Removethemifyoudon’tusethepluginanymore. Italsoletsyouseespecificpluginmodulesthatincreaseyourdatabasesize.Inmycase,IrealizedRankMath’smodulesaddedalotofdatabasebloat,soIdisabledsomeofit’smodules.   9.DisableResource-HungryBackgroundTasks ItalkedabouthighCPUplugins(i.e.backups),pluginmodules,andHeartbeat. Alltheseruninthebackgroundandeventhoughtheydon’timpactcorewebvitals,theyincreaseCPUandcanresultin503serviceunavailableerrors.Butifthere’sanythingelserunninginthebackgroundofyourWordPresswebsite,consideroptimizingit.SchedulebackupsduringlowtraffichoursandpreventhighCPUtasksfromrunningsimultaneously.   10.Don’tUseWooCommerceOnSharedHosting Thisisarecipefordisaster. WooCommerceshouldalwaysrunonamorepowerfulserverbecauseoftheextraCSS,JavaScript,cartfragments,andpluginsWooCommercesitesusuallyhavetorun.Sorry,butifyoudon’thaveenoughmoneyforVPS/cloudhosting,youprobablyshouldn’tbestartinganeCommercesiteanyway.IncreaseyourhostingbudgetandgetsomethinglikeCloudwaysVultrHighFrequency,managedcloudhostingfromNameHero,orKinstawhousesGoogleCloudC2.   11.Don’tUseSlowPageBuildersOnSharedHosting ThisisanotherrecipefordisasterandechoestheproblemswithWooCommerce. ElementorandDivi(specifically)canconsumelotsofresourcesespeciallywhenusinguptheeditor(manypeopleinFacebookGroupscomplainabout503errorswhenusingtheirEditor). Onceagain,don’tuseaslowpagebuilderonsharedhosting.YoucaneitherusefasterhostingorremoveyourpagebuilderandusealightweightalternativelikeGeneratePress,Gutenberg,KadenceTheme,GenesisFramework,orevenElementor’sHellotheme.Lookatthespeedtests. ElementorandDiviareslowinpagebuilderspeedtests   12.BlockBadBotsFromHittingYourServer UseCloudflare’sbotfightmodeortheBlackholeForBadBotsplugintoblockspambots. YoucancheckforbadbotsusingWordfence’slivetrafficreport,butdeletethepluginwhenyou’redonesinceWordfencealsoconsumesCPUandcancause503serviceunavailableerrors.   13.DisableCachePluginSettingsThatRisk503Errors SomecachepluginsettingsconsumeCPUandyouneedtodigthroughtheirdocumentationtolearnwhethertheydo,ornot. InmyLiteSpeedCachetutorial,Iaddedabluewarningnexttopluginsettingsthatcanconsumeresources(guestmode,cachelogged-inusers,cachecommenters,cachemobile,servestale,instantclick,andcrawlersettings).Somedocumentationliterallysays“ResourceUsageWithGuestOptimization.”CheckthedocumentationtoseeifcertainpluginsettingsincreaseCPU.   14.ProtectYourWP-loginPage Thewp-loginpageisacommontargetforbadbots. YoucanprotectitusingLimitLoginAttemptsthenmovingtheloginpagetoacustomURL(usingapluginorPerfmatters).Butifyou’reusingQUIC.cloudCDN,youprobablydon’twanttomoveitsinceQUICalreadyprotectstheloginpage.Thisshouldstopspambotsfromhittingit.   15.DeleteUnusedThemesAndPlugins Thisisobvious,butIwantedtoemphasizeit. SomepeoplealsoforgottodeletethemesunderAppearance>Themes.   16.KeepEmailAndWebHostingSeparate Whenyougroupemailandwebhostingtogether,emailconsumesbandwidthandstorage. Thereareseveralreasonsyoushouldkeepthemseparate(likenotbeingstuckwithyourhostingcompanybecauseyouusethemforemail).GoogleWorkspaceis$6/monthandkeepsthemseparatesoyoudon’thavetoworryaboutyouremailconsumingresourcesorbeingstuck.   17.RemoveBloatFromTheWordPressAdmin Thereareseveralpluginstoremovebloat: Debloat Perfmatters WidgetDisable DisableWooCommerceBloat SomeofthesepluginshaveadditionalsettingsthatcanreduceCPUandimprovecorewebvitals,soIsuggestcheckingouttheirdescriptionsandreviews,thenusingtheonesyouneed.   18.DisableWP-CronAndReplaceWithRealCronJobs WP-Cronmanagesscheduledeventsforyourwebsiteandiscalledwheneversomeonevisitsyourwebsite.ThiscanincreaseCPUusageandcause503serviceunavailableerrors.MosthostingcompanieshaveinstructionstodisableWP-Cronthenreplaceitwitharealcronjob.YoucanusetheWPCrontrolplugintoview/controlwhat’shappeningintheWP-Cronsystem.   19.503ErrorsOnSharedHosting(GoDaddy,Bluehost,Hostinger) GoDaddy,Bluehost,Hostinger,andnearlyallsharedhostingprovidershavelowCPUlimitswhichcanresultin503serviceunavailableerrors. GoDaddyisverymisleading.Forexample,theirDeluxehostingplansaysit’sidealforupto100Kmonthlyvisitors.ButwhenyoucheckGoDaddy’sresourcelimitspage,alltheirsharedhostingplansinclude250,000inodeswhichisdefinitelynotenoughfor100kmonthlyvisits. Bluehostonlyincludes200,000inodesonallsharedhostingplanswhichisevenlowerthanGoDaddy.Theyalsolimitdatabasetablesto5,000,databasesizeto10GB,anddatabaseusageto5Gbinasingledatabase.LikeGoDaddy,theyalsoclaimyoucanhostunlimitedwebsites,butyouwilllikelyrunintoCPUlimitsifyouhosttwoorthreesmallsites.Don’tfallfortheseclaims. Hostingeratleastincreasesyourinodelimitsasyouupgradetohigherplans,soyou’relesslikelytoruninto503serviceunavailableerrorswiththem.Butthey’reaveryunethicalhostwhowritesfakereviews,hashorriblesupport,andsecurityissues–Idon’trecommendthem.   20.MoveToFasterHostingWhoDoesn’tHaveStrictCPULimits Idon’trecommendupgradingplansifyou’reusingcheapsharedhosting. You’rebetteroffbitingthebulletandusingsomeonelikeCloudwaysVultrHighFrequencyorNameHerowhoarestillcheap,butmuchfasterthananyofthelowqualityhostsmentionedinthistutorial.Theyalsodon’thavestrictCPUlimitssoyoushouldn’truninto503errorsunlessyou’reactuallyrunningaresource-hungrywebsitewithlotsofvisitorsonacheaphostingplan.A2GBVultrHFserveronCloudwaysorNameHero’sTurboCloudplanblowstheotherhostsoutofthewaterasfarasspeed,support,andabilitytohandleadecentamountofCPUusage. JointheWPSpeedMattersFacebookGroupandyou’llseethey’rebothrecommendedhighly.Cloudwaysisalittlemore“techie”becauseyouhavetolaunchaserverandtheyuseacustomdashboard.You’llprobablywanttouseWPRocketandCloudflareorBunnyCDNforyourCDN.NameHeroismorebeginner-friendlywithcPanelandLiteSpeed,soyou’llwanttousetheLiteSpeedCacheplugin+QUIC.cloudCDN.Ionlyuseaffiliatelinkstogoodhosts,notbadones. IswitchedfromSiteGroundtoCloudwaysin2019.Myresponsetimeswere2xfaster,Iwaspaying1/2thepriceofwhatIwasonSiteGround,andhadnoCPUissuesorhighrenewalprices. Whenindoubt,checkrecentFacebookpollsandmigrationresults(viewmorehere). Source:WordPressHostingFacebookGroup Source:SEOSignalsLab Source:WordPressHosting Source:OxygenUserFacebookGroup Source:WPSpeedMatters Source:Twitter Source:OxygenUserFacebookGroup Source:ElementorCommunity Source:BloggersPassion Source:SEOSignalsLabFacebookGroup Source:DiviThemeUsers Source:Twitter 25%off2monthsofCloudwayswithcodeOMM25(orusetheircouponspagefor30%off3months) Conclusion:Ireallyhopethiswashelpful.Butifyoustillhave503serviceunavailableerrorsaftertryingeverythinginthistutorial,leaveacommentandI’llbegladtohelphoweverIcan. Cheers, Tom Yo,I'mTom.IwriteaboutWordPressspeed,hostingthat'snotgarbage,andalittleSEO.Checkoutmybiowhichhas50randomanddisturbingthingsaboutme-withcat/travelpics! WordPressSpeedGuidesWordPressHostingReviewsWordPressSEOGuidesGetTheLowDown Leavethisfieldemptyifyou'rehuman: LeaveaReplyCancelreplyYouremailaddresswillnotbepublished.Requiredfieldsaremarked*Comment*Name Email Website OMMLogoFinalAboutTomTomDupuisstartedOMMin2011.HefallsasleeptoserialkillerdocumentariesandpukesinMobilgarbagecans.Readhisbiotolearn50randomanddisturbingthingsaboutTomandthestoryofOnlineMediaMasters. AboutTom ContactUs(720)699-1836 [email protected] [email protected] ©2022OnlineMediaMasters|PrivacyPolicy|AffiliateDisclaimer Thiswebsiteusescookiestoensureyougetthebestexperience(seeourPrivacyPolicy.Gotit!



請為這篇文章評分?