Best way to sync physics between client/server?

I’ve been working on integrating networking into my sandbox game. Right now, the way I’m handling the physics is letting the clients do their own simulating, and having the server send 2 sync packets: linear and angular velocity every second, and position every 3 seconds. Sounds good, but lag (even when the client and server are both localhost) causes problems when more than a few bodies are in the world. Is there a better way to do this?

This is a 2D game, I’m using the JBox2D engine.

Right now I’m doing physics and drawing in the same thread, so I guess that could be part of the problem.

My physics uses all ints/longs so that once things are “synced” they stay synced. Then I progress frame by frame, with hash checks on the state. All events are “synced” up on the same frame in all clients. The server tells them what frame events happen on. If a client gets out of sync it missed an event --it regets the events from the last correct hash check. and then “replays” as fast as it can to catch up.

I have had no problems with 100k things, boids and simple physics.

Note that with strict match you could get the some syncing, but ints are easier on the network.