SQL 2014 Availability group of Same DB produces different size Backup from Node A to Node B I have this code in a SQL Job to run a database backup on the hour.

IF sys.fn_hadr_backup_is_preferred_replica('AdventureWorks') = 1
BEGIN
  declare @seq varchar(7) = '-' + Right('00' + cast(datepart(HOUR, getdate()) % 24 as varchar(2)), 2) + '.bak'
  ...
  WITH INIT, FORMAT, COPY_ONLY, CREDENTIAL = 'AdventureWorksAzureBackupStorage', compression, stats=1
END


The question I have is if I take out the check for fn_hadr_backup_is_preferred_replica
and just run

BEGIN
  declare @seq varchar(7) = '-' + Right('00' + cast(datepart(HOUR, getdate()) % 24 as varchar(2)), 2) + '.bak'
  ...
  WITH INIT, FORMAT, COPY_ONLY, CREDENTIAL = 'AdventureWorksAzureBackupStorage', compression, stats=1
END


on first A, then on B, then the size of the databases are vastly different, e.g. Active Node database backup is 8 times larger than passive node database backup.

Is there an explanation for this please? Is the Active node not compressed perhaps? And the passive node is compressed?
In AGs writes can only occur on the primary. Since the AlwaysOn Availabiliy Groups feature was introduced, we got new options to make the backups strategy more complete, but also more complex. Taking an advantage of secondary replicas, we can offload both, the FULL and even the Transaction Log backups from the Primary Replica to the Secondary, leaving the Primary replica dedicated to serve the production application.

For example i am attaching here a 'Backup preferences' Window screen for your better understanding.



Note

1)Full and differential backups always run on the primary replica.
2)Full copy only and transaction log backups run either on the primary replica, if the primary replica is set as the preferred replica for running backups, or on the secondary replica with the highest backup priority.
3)For successful backup of availability databases, verify that the secondary replica can communicate with the primary replica, and that the replicas are either Synchronized or Synchronizing.


As per mssqltips blog documentation  Here 

Microsoft has provided us with a system function called sys.fn_hadr_backup_is_preferred_replica. This function will return 0 if the current instance is not the preferred backup location or 1 if it is the preferred replica for backups according to the preference and priority settings

IF sys.fn_hadr_backup_is_preferred_replica(@DatabaseName) = 1
BEGIN
  --Perform backup
END


The AG behavior of the “Backup Priority” setting:

The replicas with the lower value will be in the end of the queue.
Those replicas will only be used if no other is available.
The replicas with the higher priority value will be on the top of the backup replica choice.
In the case of have two or more replicas with the same priority value (weight) SQL Server will give priority based on the alphabetical order.

For Your further refence Understanding backups on AlwaysOn Availability Groups &amp; Here