I have two identical servers (same hardware, cpu, memory etc) in an AlwaysOn cluster (sync commit and read-intent enabled), both servers running with SQL Server 2016 SP1 (13.0.4001.0).
For some of the queries with identical query plans and statistics, the queries are taking over 10secs to run on the secondary replica where as they finish under 2 secs on the primary replica. I have verified the statistics and query plans are exactly the same and tested executing the queries with no other load on these servers. Not able to find the reason why queries are slow on secondary replica.

Query and Plan from primary replica  

<https://www.brentozar.com/pastetheplan/?id=S1O5Yxscb>

Query and Plan from secondary replica  

<https://www.brentozar.com/pastetheplan/?id=SJdz5ljq->

However, when I give a maxdop = 8 hint in the query on the secondary server, the n it finishes in 2secs.

Also, when I switch roles upon failover, the query executes in 2 secs on the new primary server and on the secondary server it again takes around 10secs. So doesn't seem to be a hardware problem as the query executes fast on the server which ever is designated as primary on the AG cluster and it runs slow on the secondary node.