Robert Graham (masscan author) gave a talk on scaling to 10 millions packets at Shmoocon 2013 - C10M Defending The Internet At Scale [1, 2]. You basically bypass the kernels network stack and its robust features, and use a special purpose built drive (i.e. "PF_RING DNA"), which you heavily customize. You also need to write your application in a way that can assign CPU and memory for your tasks. This is not just a, run X and get 10 millions packets second, it is a very planned out exercise.