Cost of replaying transaction log on sql server HA replica
But it got me wondering, which is actually doing more work? The primary or the replicas?


The Primary.  The secondary doesn't have to run the SELECT,INSERT,UPDATE, and DELETE statements for the sessions that are modifying the database.  The log records resulting from those operations are sent to the secondary which copies them to its log file and then applies them to the database using the REDO process.

The Secondary can sometimes perform more IO than the primary, as the primary writes the log file, and lets the Checkpoint/Lazywriter write the database.  But overall the Primary does more work.


  That would mean the replica would need to do a key lookup for each row instead of an index scan, which would be a lot more expensive.


The secondary doesn't apply the logical operation.  The log record indicates exactly what modifications are made to the database pages.


  Also, are the physical pages of the replicas exactly identical to the primary at the byte level?


Yes.  In fact a if the primary discovers a corrupt page, it will repair the corruption by getting an uncorrupted copy of the page from a secondary.  This is called Automatic Page Repair