With the amount of data generated by Internet of Things (IoT) devices increase dramatically, the insufficient computing ability of terminal devices becomes obvious when processing massive computing tasks. The computing tasks need to be offloaded from resource-constrained devices to edge servers with stronger computing capability. It is a challenge for computing offloading to achieve global optimization with multiple objectives such as minimizing task completion times, optimizing energy consumption and maintaining load balancing as the network state and task demands dynamically change. This paper presents optimized edge computing offloading algorithm for software-defined IoT. First, to provide global state for making decisions, a software defined edge computing (SDEC) architecture is proposed. The edge layer is integrated into the control layer of software-defined IoT, and multiple controllers share the global network state information via east-west message exchange. Moreover, an edge computing offloading algorithm in software-defined IoT (ECO-SDIoT) based on deep reinforcement learning is proposed. It enables the controllers to offload the computing task to the most appropriate edge server according to the global states, task requirements, and reward. Finally, the performance metrics for edge computing offloading were evaluated in terms of unit task processing latency, load balancing of edge servers, task processing energy consumption, and task completion rate, respectively. Simulation results show that ECO-SDIoT can effectively reduce task completion time and energy consumption compared with other strategies.