One of goals of Magento 2 project was providing software with modularity. It gives us many advantages, and one of them is ability to disable modules which are not used. This speeds up compilation process, makes admin backend less-cluttered (what should improve UX) and finally, speeds up page load times.

Let's see what gains it can give. I simply measured load times for the clean Magento installation, the disabled modules and measured them again. To benchmark it I used:

  • local environment with PHP 7.1
  • clean Magento 2.2.4 installed without demo data
  • store installed in single-store mode, cache disabled, enabled production mode

To quickly identify modules which can be disabled I used bin/magento info:dependencies:show-removable command provided by avstudnitz/disable-modules module. Each command run creates modules-removable.csv file which lists modules which can be disabled. For example:

"Modules without dependencies:" 
" =========================== " 


Then, bin/magento module:disable command can be used to disable any of these modules. It may require multiple runs - each can generate a different list as after disabling some modules, new modules without dependencies can be identified. 

Before you disable module, review its file to have an idea what it is responsible for, roughly review codebase to se if it's not used anywhere, finally, after disabling module compile store and test if everything still works fine.

Here is the final list I used:

php bin/magento module:disable \
Magento_Weee \
Magento_WebapiSecurity \
Magento_Version \
Magento_Swagger \
Magento_SampleData \
Magento_TaxImportExport \
Magento_Usps \
Magento_Ups \
Magento_Marketplace \
Magento_GroupedImportExport \
Magento_GoogleOptimizer \
Magento_GoogleAdwords \
Magento_Fedex \
Magento_DownloadableImportExport \
Magento_Dhl \
Magento_CustomerImportExport \
Magento_ConfigurableImportExport \
Magento_BundleImportExport \
Magento_AdvancedPricingImportExport \
Amazon_Core \
Amazon_Login \
Amazon_Payment \
Shopial_Facebook \
Temando_Shipping \
Dotdigitalgroup_Email \
Magento_Multishipping \
Klarna_Kp \
Magento_Authorizenet \
Magento_Braintree \
Klarna_Ordermanagement \
Klarna_Core \
Magento_Signifyd \
Magento_NewRelicReporting \
Vertex_Tax \
Magento_ReleaseNotification \
Magento_Analytics \
Magento_WishlistAnalytics \
Magento_SalesAnalytics \
Magento_ReviewAnalytics \
Magento_QuoteAnalytics \
Magento_CustomerAnalytics \

Simple benchmarks done before disabling modules:

  • Compilation time: 1 min 48 s
  • Product page load time: 10,06s
  • Homepage load time: 8,69s 

And after:

  • Compilation time: 1 min 25 s
  • Product page load time: 7,06s
  • Homepage load time: 5,58s 

Disabling not needed modules is simple task which just requires a bit of QA, but as you can see above, it can give significant speed gains. It's worth to perform this task on each store and repeat the review regularly. 

Note: initially I also disabled Magento_Persistent module. Unfortunately, it introduced bugs in add to cart flow, so it's better to leave this one enabled. I also kept Magento_OfflineShipping and Magento_OfflinePayments enabled as they can be used in other modules too.