In order to apply different scheduler-maps for various subinterfaces under the same physical port; you will need IQ functionality (IQ PIC). If you have a 'regular' ethernet port, then you can specify different classifiers for different subinterfaces, but you will need to use the same scheduler-map for all of them (at physical port level).

That said, and assuming you already have a 'ruleset' on your mind, you will first need to distinguish different types of traffic on the port, in other words “assign packet characteritics with forwarding-class'es”.

This is mostly done by using classifiers, for example:

 class-of-service {
     classifiers {
         dscp Core {
             import default;  #### import the default values which you can see with CLI command 'show class-of-service classifier'. This may save you typing.
             forwarding-class best-effort { ### and alter some, if necessary
                 loss-priority high code-points [ 001100 001110 ];
             }
         }
   }

That was for ingress. For egress (and consistency between your routers), rewrite-rules need to be configured accordingly, something like:

 rewrite-rules {
      dscp Core {
          forwarding-class best-effort {
              loss-priority low code-point 000000;
              loss-priority high code-point 000000;
          }
          forwarding-class expedited-forwarding {
              loss-priority low code-point 101110;
          }
          forwarding-class assured-forwarding {
              loss-priority low code-point 001010;
          }
          forwarding-class network-control {
              loss-priority low code-point 110000;
              loss-priority high code-point 111000;
          }
      }
  }

You will then need to define schedulers where you 'allocate' your resources among your forwarding-class'es (queues) ['percent' values are mostly made up, just as examples]

   schedulers {
      ef_Core {
          transmit-rate percent 25; ## allocate 25% of available interface bandwitdth for expedited-forwarding
          buffer-size percent 15; ## allocate 15% of available interface buffer
          priority strict-high;  ## priority. please refer to documentation for the difference between 'high' and 'strict-high'
      }
      af_Core {
          transmit-rate percent 40;
          buffer-size percent 30;
          priority high;
      }
      nc_Core {
          transmit-rate percent 10;
          buffer-size percent 10;
          priority high;
      }
      be_Core {
          transmit-rate remainder;
          buffer-size percent 45;
          priority low;
      }

You will then need to use them in a scheduler-map, where you assign schedulers with a forwarding-class:

  scheduler-maps {
         Core {
             forwarding-class best-effort scheduler be_Core;
             forwarding-class expedited-forwarding scheduler ef_Core;
             forwarding-class assured-forwarding scheduler af_Core;
             forwarding-class network-control scheduler nc_Core;
         }
    }

With all in place, last you'll need to apply your classifiers, rewrite-rules and scheduler-maps to the interface. In this example, I'm assuming you have a non-IQ PIC.

 class-of-service {
  interfaces {
   ge-4/1/0 {
             scheduler-map Core;
             unit 0 {
                 classifiers {
                     dscp Core;
                 }
                 rewrite-rules {
                     dscp Core;
                 }
             }
      }
   }
 }

Finally, you can check your work with the following commands:

> show class-of-service interface xxxx ## you can see whether or not your configuration is properly applied

> show interfaces queue xxx # where you can see some statistics with regards to interface queues

> show interfaces xxx extensive # where you'll see queue counters for most interface types.

You also have the possibility to use firewall filters instead of classifiers, other components like shaping, drop profile etc. and this examples are intended to give you a better understanding of the components only, never a 'suggested config snippet'

Relevant JUNOS documentation: http://www.juniper.net/techpubs/software/junos/junos84/swconfig84-cos/frameset.html (or whichever version you have)

Thx: Erdem at juniper-nsp@puck.nether.net